Board index » delphi » How can I know what subitem is selected in TListview ?

How can I know what subitem is selected in TListview ?


2003-09-18 03:26:31 AM
delphi117
Hi,
When I click in a subitem in TListview how can I know what subitem (and item) is selected ?
Thanks,
Pierre
 
 

Re:How can I know what subitem is selected in TListview ?

On 17 Sep 2003 12:26:31 -0700, "Pierre Mark"
<XXXX@XXXXX.COM>writes:
Quote
When I click in a subitem in TListview how can I know what subitem (and item) is selected ?
Subclass the list view, handle the WM_NOTIFY message, and check for
the NM_CLICK notification. The lParam parameter points to a record
containing information about the clicked item or sub-item.
---
Yorai Aminov (TeamB)
develop.shorterpath.com/yorai
(TeamB cannot answer questions received via email.)
 

Re:How can I know what subitem is selected in TListview ?

In article <XXXX@XXXXX.COM>, Yorai Aminov (TeamB) writes:
Quote
>When I click in a subitem in TListview how can I know what subitem (and item) is selected ?

Subclass the list view, handle the WM_NOTIFY message, and check for
the NM_CLICK notification. The lParam parameter points to a record
containing information about the clicked item or sub-item.
CM_NOTIFY, WM_NOTIFY goes to the listviews parent.
Peter Below (TeamB)
Use the newsgroup archives :
www.mers.com/searchsite.html
www.tamaracka.com/search.htm
groups.google.com
www.prolix.be
 

Re:How can I know what subitem is selected in TListview ?

In article <3f68b567$XXXX@XXXXX.COM>, Pierre Mark writes:
Quote
When I click in a subitem in TListview how can I know what subitem (and item) is selected ?

Detecting clicks on subitems in a report-style listview
Quote
Is it possible to activate the click or doubleclick event
for the subitems of a listview item? If yes, how can I do it?
uses CommCtrl;
{$R *.dfm}
procedure TForm1.ListView1Click(Sender: TObject);
var
pt: TPoint;
item : TLIstItem;
hittestinfo: TLVHitTestInfo;
begin
pt:= listview1.ScreenToClient( mouse.cursorpos );
item := listview1.GetItemAt( pt.x, pt.y );
If assigned( item ) then
memo1.Lines.add('Hit on item '+item.Caption )
else begin
FillChar( hittestinfo, sizeof( hittestinfo ), 0 );
hittestinfo.pt := pt;
If -1 <>listview1.perform( LVM_SUBITEMHITTEST, 0, lparam(@hittestinfo))
Then Begin
memo1.lines.add( format(
'Item: %d (%s), subitem: %d (%s)',
[hittestinfo.iItem, listview1.items[hittestinfo.iItem].caption,
hittestinfo.iSubItem,
listview1.items[hittestinfo.iItem].Subitems[ hittestinfo.iSubItem-1 ]] ));
End
Else
memo1.lines.add( 'Not on item or subitem');
end;
end;
Peter Below (TeamB)
Use the newsgroup archives :
www.mers.com/searchsite.html
www.tamaracka.com/search.htm
groups.google.com
www.prolix.be
 

Re:How can I know what subitem is selected in TListview ?

On Thu, 18 Sep 2003 19:13:10 +0200, "Peter Below (TeamB)"
<XXXX@XXXXX.COM>writes:
Quote
CM_NOTIFY, WM_NOTIFY goes to the listviews parent.
Yes.
---
Yorai Aminov (TeamB)
develop.shorterpath.com/yorai
(TeamB cannot answer questions received via email.)