|
-
May 19th, 1999, 02:25 PM
#1
CListCtrl Report
OK, I want to just add the resource, fill it with data, and then click on it anywhere on the line then return nIndex (which row). I can fill it, but I cant get where it was clicked on or handle the whole line
-
May 19th, 1999, 03:18 PM
#2
Re: CListCtrl Report
int i, count = m_ctrlyourlist.GetItemCount();
CString somevalue;
for ( i=0; i < count; i++ )
if ( m_ctrlyourlist.GetItemState( i, LVIS_SELECTED ) )
{
// get the data out of first column
somevalue=m_ctrlyourlist.GetItemText( i,0);
}
-
May 20th, 1999, 02:37 AM
#3
Re: CListCtrl Report
You can use the HitTest() method of CListCtrl.
-
May 20th, 1999, 06:36 AM
#4
Re: CListCtrl Report
You will need to decide when you want to do the action. It can be on a button click, or on a click in the list control (catch NM_CLICK), or when an item changes (LVN_ITEMCHANGED).
Then in the code you can use GetNextItem to iterate through the list.int nSelItem = -1;
while ( -1 != ( nSelItem = m_list.GetNextItem(nSelItem, LVNI_SELECTED) ) )
{
// Do stuff
}
-
May 20th, 1999, 03:19 PM
#5
Re: CListCtrl Report
1.subclass clistview
2.Track lbuttondown message
3.use CListCtrl HitTest function to get list item id
-
May 27th, 1999, 02:20 AM
#6
Re: CListCtrl Report
In NM_CLICK use
SubItemHitTest(LPLVHITTESTINFO HitInfo)
This will return the iItem and iSubItem (in HitInfo structure). You also get the info whether the click was made on the item icon or item label or above or below or to the left or to the right of the client area of the list control.
If click is made on the item,
iItem = Item index and
iSubItem = 0
If the click is made on the subitem
iItem = SubItem's parent item
iSubItem = SubItem index
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|