Re: [WIN] ListView: what event is response to clicking on item? (& attn: Fabio)
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Oct 19, 2001
- 506 views
Matt, I did find that LVN_ITEMCHANGED constant in "Winconst.ew", but couldn't figure out how to use it. I can use the "onEvent" thingy in a sort of "cut'n'paste" way, but don't really understand it very well. (I'm guessing that's what's involved?) At your convenience, could you explain more fully how to make use of LVN_ITEMCHANGED ? I've used Eumans suggestion, for listview selection tracking mouse movements, and single click activation, but LVN_ITEMCHANGED is maybe closer to how one might expect to use it, like "onChange" (or at least consistent with how we get stuff from other lists). Dan ----- Original Message ----- From: "Matthew Lewis" <matthewwalkerlewis at YAHOO.COM> To: "EUforum" <EUforum at topica.com> Sent: Friday, October 19, 2001 5:25 AM Subject: RE: [WIN] ListView: what event is response to clicking on item? (& attn: Fabio) > > > > -----Original Message----- > > From: Derek Parnell [mailto:ddparnell at bigpond.com] > > > It seems that the library doesn't implement this yet. The > > best you can do > > for now (other than euman's suggestion) is to trap the > > WM_NOTIFY event for > > the listview's parent window. Then extract the notification > > code and if it's > > NM_CLICK and the control id in the message matches the > > Listview's id, you > > can then use getLVSelected() etc... > > > > If you like, I can play around to get the exact code you'd need. > > > > IIRC, ListViews don't handle mouse events like most controls, but I'm fairly > certain that you can get the NM_CLICK to work. Alternatively, you could > look for LVN_ITEMCHANGED: > > LVN_ITEMCHANGED > > > Notifies a list-view control's parent window that an item has changed. This > notification message is sent in the form of a WM_NOTIFY message. > > LVN_ITEMCHANGED > pnmv = (LPNMLISTVIEW) lParam; > > Parameters > pnmv > Address of an NMLISTVIEW structure that identifies the item and specifies > which of its attributes have changed. If the iItem member of the structure > pointed to by pnmv is -1, the change has been applied to all items in the > list view. > Return Values > No return value. > > Remarks > If a list-view control has the LVS_OWNERDATA style, and the user selects a > range of items by holding down the SHIFT key and clicking the mouse, > LVN_ITEMCHANGED notifications are not sent for each selected or deselected > item. Instead, you will receive a single LVN_ODSTATECHANGED notification, > indicating that a range of items has changed state. > > > Of course, you'll have to make sure that it's the LVIS_SELECTED that's > changed... > > Matt Lewis >