Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Hide horizontal scrollbar in a TListView

Posted on 2001-06-12
7
Medium Priority
?
918 Views
Last Modified: 2010-04-06
How to hide the (optional)horizontal scrollbar in a TListView?
0
Comment
Question by:bengore
  • 4
  • 2
7 Comments
 
LVL 8

Expert Comment

by:Cesario
ID: 6181447
Hi bengore,

AFAIK, you can hide both scrollbar.

Derive a new control from TTreeview and override its CreateParams method like this:

procedure tNoScrollbarsTreeview.createparams(var params: TCreateParams);
begin
  inherited;
  params.style := params.style or TVS_NOSCROLL;
end;

Best Regards

Cesario
0
 

Author Comment

by:bengore
ID: 6182011
I don't want to make a new component. Is there no possibility to make the changes in the FormCreate procedure like:
SetWindowsStyle(Listbox.Handle, TVS_NOSCROLL) or some other Windows API function?
0
 
LVL 8

Expert Comment

by:Cesario
ID: 6182042
Hi bengore,

no its not possible. The Listview manage the Scrollbars and will show them automaticly.

I hope some other Experts here can help you.

Best Regards

Cesario
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 8

Expert Comment

by:TOndrej
ID: 6182160
try this:

ShowScrollBar(MyListView.Handle, SB_HORZ, False);
0
 
LVL 8

Expert Comment

by:Cesario
ID: 6182201
Hi TOndrej,

it works but if you scroll down the Scrollbar appears again. ( that is window :-) )

Cesario
0
 
LVL 8

Accepted Solution

by:
TOndrej earned 210 total points
ID: 6182325
Hi Cesario,

you can hide it again... a very raw example:

  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.
0
 
LVL 8

Expert Comment

by:Cesario
ID: 6182379
Cool solution :_)))

Cesario
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .

963 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