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 draw an underline on a Listview Caption 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
17-Sep-02
Category
VCL-General
Language
Delphi 3.x
Views
128
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

Can you underline the caption of a ListView Item?

Answer:

To draw an Underline on a Listview Caption the same like the HotTrack function in 
Delphi 6 in Delphi 3 you must call an API function.

In the Uses Clausse inpelement the CommCtrl unit.

Then you set the following code in the MouseMove property of your ListView.

1   
2   procedure TfrmMain.lvwMainMouseMove(Sender: TObject; Shift: TShiftState; X,
3     Y: Integer);
4   const
5     LVS_EX_UNDERLINEHOT = $00000800;
6     LVS_EX_INFOTIP = $00000400;
7   var
8     AItem: TListItem;
9     Styles: DWord;
10  begin
11    //This line is a VCL Bugfix for the ListView
12    Styles := LVS_EX_INFOTIP;
13    AItem := lvwMain.GetItemAt(X, Y);
14    if not Assigned(AItem) then
15    begin
16      lvwMain.Cursor := crArrow;
17    end
18    else
19    begin
20      lvwMain.Cursor := crHandPoint;
21      Styles := Trunc(Styles + LVS_EX_UNDERLINEHOT - LVS_EX_CHECKBOXES -
22        LVS_EX_FULLROWSELECT);
23      ListView_SetExtendedListViewStyle(lvwMain.Handle, Styles);
24    end;
25  end;



When you goes with your mouse over an ListView Item there will be an underline 
drawed under the caption of the Item.

Because the value that exists in the Styles variabele allso enables checkboxes and 
rowselect add the following lines under the Styles lines and above the 
SetExtendedListViewStyle.

26  Styles := Styles - LVS_EX_CHECKBOXES;
27  Styles := Styles - LVS_EX_TRACKSELECT;


This will fix the bug of the Checkboxes and TrackSelecting.

			
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