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
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
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
4. Re: Detecting cursor in ListView (Combo Box - W32Lib)
- Posted by Pete Stoner <stoner.pete at gmail.com>
Jan 26, 2006
-
Last edited Jan 27, 2006
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
5. Re: Detecting cursor in ListView (Combo Box - W32Lib)
- Posted by Pete Stoner <stoner.pete at gmail.com>
Jan 26, 2006
-
Last edited Jan 27, 2006
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
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
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
It was a nice idea but not worth me getting into an owner-drawn
control.. I'll try something else.
PeteS