1. Detecting cursor in ListView (Combo Box - W32Lib)

When a user clicks on a dropdown to open it (Combo box actually) and the
highlight follows the cursor as he moves down the list, is there any way to
detect which item he is on (highlighted but not selected)?

I would like to be able to display some text giving more information on each
item as the user moves the cursor down the list...

Regards PeteS

new topic     » topic index » view message » categorize

2. Re: Detecting cursor in ListView (Combo Box - W32Lib)

Pete Stoner wrote:
> 
> When a user clicks on a dropdown to open it (Combo box actually) and the
> highlight
> follows the cursor as he moves down the list, is there any way to detect which
> item he is on (highlighted but not selected)?
> 
> I would like to be able to display some text giving more information on each
> item as the user moves the cursor down the list...
> 
> Regards PeteS

As far as I can determine Windows does not send any notifications when the
highlighted item is changed. The only exception is when the Combobox is
owner-drawn. Windows would then send a WM_DRAWITEM notification whenever an item
was drawn. This notification would contain the highlighted item.

Owner-drawn controls aren't particularly complicated but there are a lot of
details that must be taken care of. I have never done this with a Combobox.

Larry Miller

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

3. Re: Detecting cursor in ListView (Combo Box - W32Lib)

Pete Stoner wrote:
> 
> When a user clicks on a dropdown to open it (Combo box actually) and the
> highlight
> follows the cursor as he moves down the list, is there any way to detect which
> item he is on (highlighted but not selected)?
> 
> I would like to be able to display some text giving more information on each
> item as the user moves the cursor down the list...
> 
> Regards PeteS

Here is some code Roland Stowasser wrote for me. It assumes right click but you
might be able to use when moving the mouse with some adjustments.
procedure MenuEditList_Mouse (integer self, integer event, sequence params)
--Roland right click

    integer index, state
    atom bool,height,topindex,indexoffset
     
    if params[1] = RightDown then
--you would use MouseMove above instead of RightDown or LeftDoubleClick
        
            height=sendMessage(Combo2,LB_GETITEMHEIGHT,0,0)
            topindex=sendMessage(Combo2,LB_GETTOPINDEX,0,0)
            indexoffset=floor(params[3]/height)
            index=indexoffset+topindex

            bool=sendMessage(Combo2,LB_SETCURSEL,index,0)
            index+=1
            if index>getCount(Combo2) then
                index=0
            end if
    end if        


Hope this helps; sorry I did not have time to test the code.

~judith

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

4. Re: Detecting cursor in ListView (Combo Box - W32Lib)

Judith Evans wrote:
> 
> Pete Stoner wrote:
> > 
> > When a user clicks on a dropdown to open it (Combo box actually) and the
> > highlight
> > follows the cursor as he moves down the list, is there any way to detect
> > which
> > item he is on (highlighted but not selected)?
> > 
> > I would like to be able to display some text giving more information on each
> > item as the user moves the cursor down the list...
> > 
> > Regards PeteS
> 
> Here is some code Roland Stowasser wrote for me. It assumes right click but
> you might be able to use when moving the mouse with some adjustments.

> snipped
> 
> Hope this helps; sorry I did not have time to test the code.
> 
> ~judith

Thanks Judith, I'll give it a try..

PeteS

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

5. Re: Detecting cursor in ListView (Combo Box - W32Lib)

Larry Miller wrote:
> 
> Pete Stoner wrote:
> > 
> > When a user clicks on a dropdown to open it (Combo box actually) and the
> > highlight
> > follows the cursor as he moves down the list, is there any way to detect
> > which
> > item he is on (highlighted but not selected)?
> > 
> > I would like to be able to display some text giving more information on each
> > item as the user moves the cursor down the list...
> > 
> > Regards PeteS
> 
> As far as I can determine Windows does not send any notifications when the
> highlighted
> item is changed. The only exception is when the Combobox is owner-drawn.
> Windows
> would then send a WM_DRAWITEM notification whenever an item was drawn. This
> notification would contain the highlighted item.
> 
> Owner-drawn controls aren't particularly complicated but there are a lot of
> details that must be taken care of. I have never done this with a Combobox.
> 
> Larry Miller


Hmm, you could be right Larry, I tried monitoring all events sent to the Combo
control before I posted but the event code was the same (probably just the mouse
move) - Not sure I want to even try going the owner-drawn route. I'll see if I
get anything with Judiths code..

PeteS

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

6. Re: Detecting cursor in ListView (Combo Box - W32Lib)

Pete Stoner wrote:
> 
> Larry Miller wrote:
> > 
> > Pete Stoner wrote:
> > > 
> > > When a user clicks on a dropdown to open it (Combo box actually) and the
> > > highlight
> > > follows the cursor as he moves down the list, is there any way to detect
> > > which
> > > item he is on (highlighted but not selected)?
> > > 
> > > I would like to be able to display some text giving more information on
> > > each
> > > item as the user moves the cursor down the list...
> > > 
> > > Regards PeteS
> > 
> > As far as I can determine Windows does not send any notifications when the
> > highlighted
> > item is changed. The only exception is when the Combobox is owner-drawn.
> > Windows
> > would then send a WM_DRAWITEM notification whenever an item was drawn. This
> > notification would contain the highlighted item.
> > 
> > Owner-drawn controls aren't particularly complicated but there are a lot of
> > details that must be taken care of. I have never done this with a Combobox.
> > 
> > Larry Miller
> 
> 
> Hmm, you could be right Larry, I tried monitoring all events sent to the Combo
> control before I posted but the event code was the same (probably just the
> mouse
> move) - Not sure I want to even try going the owner-drawn route. I'll see if
> I get anything with Judiths code..
> 
> PeteS

I had time this morning to test the code and it does not work. I expect the
sendMessage statements may only work with List control.

Sorry for sending you on a wild goose chase.

~judith

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

7. Re: Detecting cursor in ListView (Combo Box - W32Lib)

Judith Evans wrote:
> 
> Pete Stoner wrote:
> > 
> > Larry Miller wrote:
> > > 
> > > Pete Stoner wrote:
> > > > 
> > > > When a user clicks on a dropdown to open it (Combo box actually) and the
> highlight</font></i>
> > > > follows the cursor as he moves down the list, is there any way to detect
> > > > which
> > > > item he is on (highlighted but not selected)?
> > > > 
> > > > I would like to be able to display some text giving more information on
> > > > each
> > > > item as the user moves the cursor down the list...
> > > > 
> > > > Regards PeteS
> > > 
> > > As far as I can determine Windows does not send any notifications when the
> highlighted</font></i>
> > > item is changed. The only exception is when the Combobox is owner-drawn.
> > > Windows
> > > would then send a WM_DRAWITEM notification whenever an item was drawn.
> > > This
> > > notification would contain the highlighted item.
> > > 
> > > Owner-drawn controls aren't particularly complicated but there are a lot
> > > of
> > > details that must be taken care of. I have never done this with a
> > > Combobox.
> > > 
> > > Larry Miller
> > 
> > 
> > Hmm, you could be right Larry, I tried monitoring all events sent to the
> > Combo
> > control before I posted but the event code was the same (probably just the
> > mouse
> > move) - Not sure I want to even try going the owner-drawn route. I'll see if
> > I get anything with Judiths code..
> > 
> > PeteS
> 
> I had time this morning to test the code and it does not work. I expect the
> sendMessage statements may only work with List control.
> 
> Sorry for sending you on a wild goose chase.
> 
> ~judith

Thanks Judith, I haven't had time to try it for myself so you have saved me some
work smile It was a nice idea but not worth me getting into an owner-drawn
control.. I'll try something else.

PeteS

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

Search



Quick Links

User menu

Not signed in.

Misc Menu