Solved

remove scrollbars from TlistListView

Posted on 2001-08-13
3
433 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
[X]
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
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

717 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