Welcome Guest. Please Login or Register. Apr 5th, 2018, 11:52pm
ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018. Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.
If you require a dump of the post on your message board, please come to the support board and request it.
Re: ListView controls
« Reply #3 on: Nov 27th, 2010, 05:43am »
I'm getting myself in a right muddle here, bogging myself down with window controls.
I've got a columned list view and I want to select a cell with the mouse, recognise which cell it is (i.e. which row and which column), right click and select an action from the context menu. I've spent two days rumaging around msdn, but all I'm doing is confusing myself.
Help, please.
Matt
PS, how can I click anywhere on a row and have the whole row highlighted rather than just the fist column? (This is not important, just wondering.)
I've got a columned list view and I want to select a cell with the mouse, recognise which cell it is (i.e. which row and which column), right click and select an action from the context menu.
The first thing to note is that in a regular 'columned' (LVS_REPORT) List View you can only select items (rows), not cells. To discover which item(s) is/are selected you can iterate through all the items and test the LVIS_SELECTED flag in each one. n.b. if you want to disable the ability to select multiple items, use the LVS_SINGLESEL style.
To respond to a right-click you will need to intercept the WM_NOTIFY message carrying the NM_RCLICK notification. This can only be done using assembly language so is an advanced topic!
Quote:
PS, how can I click anywhere on a row and have the whole row highlighted rather than just the fist column?
Set the LVS_EX_FULLROWSELECT extended style (LVM_SETEXTENDEDLISTVIEWSTYLE message).