Re: [WIN] ListView: what event is response to clicking on item? (& attn: Fabio)
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Oct 18, 2001
- 453 views
Euman, Ok, it seemed to work ok for me except that each click on an item in the LV gets the *previously* selected item, so I have to click twice on an item to get it to work right. Here's what I did, is there something wrong with it? procedure onMouse_ListView2(integer event, integer x, integer y, integer shift) sequence index ,mleBuffer index = {} mleBuffer = {} if event = WM_LBUTTONDOWN then if getLVCount(ListView2) then index = getLVSelected(ListView2) -- on first click, sequence is empty because nothing was actually selected "yet"? if length(index) then for n = 1 to length(eMessages[index[1]][4]) do mleBuffer &= eMessages[index[1]][4][n] & CrLf end for setText(MleText3, mleBuffer) end if end if end if end procedure onMouse[ListView2] = routine_id( "onMouse_ListView2" ) Dan ----- Original Message ----- From: <euman at bellsouth.net> To: "EUforum" <EUforum at topica.com> Sent: Thursday, October 18, 2001 8:48 PM Subject: Re: [WIN] ListView: what event is response to clicking on item? (& attn: Fabio) > > I know for a fact my method works pretty well. I have an entire Family History > program written useing the listview that populates tabitems per item selected. > I can help you out further if you need me to, just let me know. > > Euman > euman at bellsouth.net > > > ----- Original Message ----- > From: "Dan Moyer" <DANIELMOYER at prodigy.net> > To: "EUforum" <EUforum at topica.com> > Sent: Thursday, October 18, 2001 21:06 > Subject: Re: [WIN] ListView: what event is response to clicking on item? (& attn: Fabio) > > > > Thanks Derek, > > > > I'll try Euman's first, then if necessary yours. When you say trap the > > WM_NOTIFY event, do you meant test for that in an onEvent? > > > > Dan > > > > ----- Original Message ----- > > From: "Derek Parnell" <ddparnell at bigpond.com> > > To: "EUforum" <EUforum at topica.com> > > Sent: Thursday, October 18, 2001 4:04 AM > > Subject: Re: [WIN] ListView: what event is response to clicking on item? (& > > attn: Fabio) > > > > > > > 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. > > > > > > ----- Original Message ----- > > > From: "Dan Moyer" <DANIELMOYER at prodigy.net> > > > To: "EUforum" <EUforum at topica.com> > > > Sent: Thursday, October 18, 2001 3:47 PM > > > Subject: [WIN] ListView: what event is response to clicking on item? (& > > > attn: Fabio) > > > > > > > > > > I've looked through back postings, and I cannot figure out how to know > > > when > > > > an item in a ListView has been clicked on. I gather that > > > "getLVSelected()" > > > > should be used instead of getIndex. I've seen suggestions for modifying > > > > Win32Lib to allow onChange to work, but that makes it not work for > > anyone > > > > who doesn't have that modification. > > > > > > > > I found Fabio Ramirez's "Listview Styles", (what a nice looking demo! > > It > > > > should be included with Win32Lib.), and that helped to make a whole row > > be > > > > selected, but I can't see how to know when an item has been clicked on. > > > > > > > > BTW, Fabio, > > > > > > > > in your tabbed version of "Listview Styles", it doesn't appear that the > > > > TreeView section works as you probably intended, in that there's only > > one > > > TV > > > > displayed with info, though you made 9, and it may not have the number & > > > > "sub-ordering" that you intended. If so, here's my fix, it lets all 9 > > be > > > > filled with items, 3 main & 3 under each main: > > > > > > > > integer tvSubItemNo-- prevents mains & subs getting mixed together > > > > > > > > procedure FillTreeView(atom tvId) > > > > for i = 1 to 3 do > > > > tvItemNo = addTVItem( tvId, icon03, icon03, > > > > sprint(tvId) & " Item " & sprint(i), 0 ) -- 0 makes > > mains > > > > for j = 1 to 3 do > > > > tvSubItemNo = addTVItem( tvId, icon03, icon03, > > > > sprint(i) & ": " & sprint(j), tvItemNo ) -- puts sub > > with > > > > correct main > > > > end for > > > > end for > > > > end procedure > > > > > > > > Dan Moyer > > > > > > > > > >