Re: ListView SINGLE-click detection
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Oct 19, 2001
- 774 views
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 > > Dan et al, > Reading back I just saw that the problem is in SINGLE-click > detecting, not double click. So try this ... > > 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. > > > atom LastLVpos -- Initialise to something, like -1 > > procedure ListView_onEvent ( int iMsg, atom wParm, atom lParm ) > seq LVpos > > if iMsg = WM_PAINT then > LVpos = getLVSelected(ListView) > > if length(LVpos) and LVpos[1] != LastLVpos then > LastLVpos = LVpos[1] > ShowSelected() > end if > end if > end procedure > > > Good luck, Andy > > >