Solved

remove scrollbars from TlistListView

Posted on 2001-08-13
3
423 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

17 Experts available now in Live!

Get 1:1 Help Now