Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

remove scrollbars from TlistListView

Posted on 2001-08-13
3
430 Views
Last Modified: 2010-04-04
Hello all

Is there a way to prevent the horizontal scrollbar to appear on a TListView ?

My Viewstyle is set to vsReport

thanks
0
Comment
Question by:fadyg
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
Tasomia earned 200 total points
ID: 6379557
TForm1 = class(TForm)
   ListView1: TListView;
   procedure FormCreate(Sender: TObject);
   procedure FormDestroy(Sender: TObject);
 private
   FListViewWndProc: TWndMethod;
   procedure ListViewWndProc(var Message: TMessage);
 public
 end;

implementation

{$R *.DFM}

procedure TForm1.ListViewWndProc(var Message: TMessage);
begin
 ShowScrollBar(ListView1.Handle, SB_HORZ, False); // hide horiz scrollbar
 FListViewWndProc(Message); // process message
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 ListView1.Items[0].Left := 300;
 FListViewWndProc := ListView1.WindowProc; // save old window proc
 ListView1.WindowProc := ListViewWndProc; // subclass
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
 ListView1.WindowProc := FListViewWndProc; // restore window proc
 FListViewWndProc := nil;
end;

(code by TOndrej)
0
 
LVL 4

Expert Comment

by:fva
ID: 6379592
Why would yo uwant to do that?

Anyway, you might try this:
Set the minimum value=maximum value for that scrollbar using SetScrollInfo.

Raw example (not tested):

uses Windows;

procedure HideHSB(alv:TListView);
var lsi:TScrollInfo;
begin
     lsi.cbSize:=sizeof(TScrollInfo);
     lsi.fMask:=SIF_ALL;
     GetScrollInfo(alv.Handle,SB_HORZ,lsi);
     lsi.nPos:=lsi.nMin;lsi.nMax:=lsi.nMin;
     SetScrollInfo(alv.Handle,SB_HORZ,lsi,true);
end;

HTH,
F.
0
 
LVL 4

Expert Comment

by:fva
ID: 6379596
Well, I guess there's always a simpler way to do things. While I wrote my comment Tasomia's one came in and I guess it's more Delphi-oriented.

F.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question