1. 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

new topic     » topic index » view message » categorize

2. Re: ListView SINGLE-click detection

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
>
>
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: ListView SINGLE-click detection

Correct me if Im wrong but Paint events for Listview and treeview are handled
by the O/S first off. Second did you try the demo Dan posted with my fix in it?
I cant see the logic in your idea right off.
 
Euman
euman at bellsouth.net


----- Original Message ----- 
From: "Andy Drummond" <kestrelandy at xalt.co.uk>
To: "EUforum" <EUforum at topica.com>
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
> > 
> > 
> > > 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
> > >
> > >
<snip>

> 
>

new topic     » goto parent     » topic index » view message » categorize

4. Re: ListView SINGLE-click detection

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
> >
> >
> > > 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
> > >
> > >
<snip>

>
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu