Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to scroll a TListBox with keyboard FlushLeft, Left, Right, FlushRight Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
27-Aug-02
Category
VCL-General
Language
Delphi 2.x
Views
83
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

How to scroll a TListBox with keyboard FlushLeft, Left, Right, FlushRight

Answer:

1   uses
2     math;
3   
4   {$R *.dfm}
5   
6   procedure TForm1.FormCreate(Sender: TObject);
7   var
8     i, n: Integer;
9   begin
10    for i := 0 to 25 do
11      listbox1.items.add(StringOfChar(Char(33 + i), Random(50) + 50));
12    canvas.Font := listbox1.font;
13    n := 0;
14    for i := 0 to listbox1.Items.count - 1 do
15      n := Max(n, canvas.TextWidth(listbox1.Items[i]));
16    listbox1.ScrollWidth := n;
17  end;
18  
19  procedure TForm1.SpeedButton1Click(Sender: TObject);
20  begin
21    Scrolllistbox(SB_LEFT);
22  end;
23  
24  procedure TForm1.SpeedButton2Click(Sender: TObject);
25  begin
26    Scrolllistbox(SB_PAGELEFT);
27  end;
28  
29  procedure TForm1.SpeedButton3Click(Sender: TObject);
30  begin
31    Scrolllistbox(SB_PAGERIGHT);
32  end;
33  
34  procedure TForm1.SpeedButton4Click(Sender: TObject);
35  begin
36    Scrolllistbox(SB_RIGHT);
37  end;
38  
39  procedure TForm1.ScrollListbox(scrollcode: Word);
40  begin
41    listbox1.perform(WM_HSCROLL, scrollcode, 0);
42    listbox1.perform(WM_HSCROLL, SB_ENDSCROLL, 0);
43  end;
44  
45  initialization
46    randomize;
47  end.


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC