RE: ListView SINGLE-click detection
- Posted by Andy Drummond <kestrelandy at xalt.co.uk> Oct 20, 2001
- 387 views
Dan, My apologies in return. What I did was put an onEvent() procedure in my program for the control I was interested in, and add a trace(1). Then every message for that control got trapped and I could see on the Euphoria debug screen what messages I was getting. I write them down and see what they all are. Probably better to simply declare a static sequence and add them into it for every message, then grab it later and see what messages I got. Sometimes it is very revealing, but usually it is totally confusing, Windows being what it is. Maybe I should write a module to convert the message into a list of WM_WHATEVER's to make it easier to see what is going on. It's a pretty basic method, but as I don't understand Windows most of the time - which is why I use Euphoria + Win32Lib + IDE to make code for it. So when I get a situation like that I have to simply see what Windows is doing and make my own interpretation of it. Andy. Dan Moyer wrote: > Andy, > > Your listView single click detection method is clearly interesting & > simple, > sorry if I made it seem I didn't think it would work, I didn't mean to. > I'll try it too. I did get the gist of it, but your further explanation > also helped. But it was what I take to be a *general* debug idea you > suggested that I didn't really understand and which intrigued me. You > said, > > > > What I do is trap EVERY message in a trace(1) and see what sequence > > > > is likly to do what I want. this works fine for me, so it should > > > > for you to. > > Could you explain *that* idea a little more? > > Dan > > > ----- Original Message ----- > From: "Andy Drummond" <kestrelandy at xalt.co.uk> > To: "EUforum" <EUforum at topica.com> > Sent: Friday, October 19, 2001 10:42 AM > Subject: RE: ListView SINGLE-click detection > > > > Dan > > > > The idea is this: there seems to be no sensible event for a single > > click on a ListView. So I put a procedure in the listview onEvent[] > > list, and then every message for the listview gets to that procedure. > > > > There I look for what's needed, in this case a WM_PAINT when the item > > clicked on is re-painted with a highlight bar. I distinguish this from > > unhighlighting by seeing if this item is one I have already handled. > > So if it's a new item, I first remember which one it is so I don't > > do the works again, then I go do whatever I want on this single click. > > > > My routine is actually ShowSelected() which I use to show the details > > of the listview item I clicked on. That way I can click on items in a > > listview and as I do show the details in another window ... and it > > seems to work just dandy! It also seems very simple to implement with > > no problems.... just thought it might solve your problem ... > > > > Andy > > > > > > Dan Moyer wrote: > > > Andy, > > > > > > I *think* I can follow what you're doing, in your specific example, but > > > not > > > sure exactly what you mean by your general method of trapping every > > > message, > > > and it sounds useful! > > > > > > Here's approximately what Euman suggested, which *works* for single > > > click > > > detection: > > > > > > -- first make an extended style listview > > > global constant ListView2 = createEx( ListView, {}, Window1, 12, 16,680, > > > 132,or_all({LVS_REPORT,LVS_SINGLESEL}), or_all({LVS_EX_FULLROWSELECT, > > > LVS_EX_ONECLICKACTIVATE})) > > > > > > -- but since (apparently) the extended styles don't get properly set(?), > > > re-set them: > > > object junk > > > atom lvMask > > > -- makes full row selected, hand pointer moving on listview items > > > selects > > > them, > > > -- single click is responded to: > > > lvMask = or_all({LVS_EX_FULLROWSELECT,LVS_EX_TRACKSELECT , > > > LVS_EX_ONECLICKACTIVATE }) > > > > > > -- hovertime makes selection happen as quick as can move mouse: > > > junk = sendMessage( ListView2, LVM_SETHOVERTIME, 0, 1)-- 1=quick select > > > junk = sendMessage( ListView2, LVM_SETEXTENDEDLISTVIEWSTYLE, lvMask, > > > lvMask) > > > > > > -- & then in an onMouse event: > > > if event = WM_LBUTTONDOWN then > > > if getLVCount(ListView2) then > > > index = getLVSelected(ListView2) > > > if length(index) then > > > > > > > > > Dan > > > > > > > > > ----- Original Message ----- > > > From: "Andy Drummond" <kestrelandy at xalt.co.uk> > > > To: "EUforum" <EUforum at topica.com> > > > Sent: Friday, October 19, 2001 5:51 AM > > > Subject: ListView SINGLE-click detection > > > <snip>