Visit our Sponsor   Visit our Sponsor
delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
500 Users Online NOW
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback





Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi



Loremo - the 1.5 liter car coming in 2009




Startblatt.de






Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (2)


How to draw an underline on a Listview CaptionFormat this article printer-friendly!Bookmark function is only available for registered users!
Product:
Delphi 3.x (or higher)
Category:
Win API
Skill Level:
Scoring:
Last Update:
04/08/2002
Search Keys:
delphi delphi3000 article borland vcl code-snippet Underline ListView API
Times Scored:
2
Visits:
3204
Uploader: Alex van der vliet
Company:
Reference: N/A
 
Question/Problem/Abstract:
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.

procedure TfrmMain.lvwMainMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
const
  LVS_EX_UNDERLINEHOT     = $00000800;
var
  AItem : TListItem;
  Styles : DWord;
begin
  AItem := lvwMain.GetItemAt(X, Y);
  if not Assigned(AItem) then
  begin
    lvwMain.Cursor := crArrow;
  end
  else
  begin
    lvwMain.Cursor := crHandPoint;
    Styles := Trunc(Styles + LVS_EX_UNDERLINEHOT - LVS_EX_CHECKBOXES - LVS_EX_FULLROWSELECT);
    ListView_SetExtendedListViewStyle(lvwMain.Handle, Styles);
  end;
end;

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





Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
Bugfix for this code
    Piet Pietersen (Apr 9 2002 10:28AM)

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.

        Styles := Styles - LVS_EX_CHECKBOXES;
        Styles := Styles - LVS_EX_TRACKSELECT;

This will fix the bug of the Checkboxes and TrackSelecting.
Respond

RE: Bugfix for this code
Alex van der Vliet (Apr 9 2002 10:54AM)

The following line must be added to the const section
  LVS_EX_INFOTIP          = $00000400;

And the following line must be added after the begin
  Styles := LVS_EX_INFOTIP;

This is a VCL Bugfix for the ListView
Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
D. Wischnewski
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)