Solved

TlistView and scrollbars

Posted on 2001-06-26
3
2,164 Views
Last Modified: 2007-11-27
Hi there,

I would like to be able to remove the horizontal scrollbar from a tlistview.

the listview has a viewstyle set to vsReport.

0
Comment
Question by:fadyg
3 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 6228219
Keep the columns within the margins...
0
 
LVL 8

Accepted Solution

by:
Cesario earned 100 total points
ID: 6228370
Hello fadyg

Try this ;-)


 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;

This will hide the horizontal scrollbar again and again whenever it receives *any* message, which is
an overkill, normally you would only hide it after receiving specific messages making the scrollbar
visible. I don't know which these are... As I said, this example is very raw.

Best Regards

Cesario

// This comment was postet 3 weeks ago
0
 

Author Comment

by:fadyg
ID: 6252355
sorry for being late on this one,

as you said "very raw".
I tried to check which messages needed to be trapped but could not. So trapping them all is the best way. Overkill but works

thanks !
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Delphi OLE Error 8 84
Newbie Thread Programming 1 118
Best Firemonkey component pack 1 74
Find and Replace Stream with 0s 8 50
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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now