Home All Groups Group Topic Archive Search About

Deriving Combobox items indexes

Author
22 Sep 2006 2:56 AM
Easton
To anyone who might be able to help.

I'm trying to derive the index of any random item in a populated combobox
dropdownlist when the mousepointer is over the item.  Seems to me it should
be possible since the item "highlights" when the mouse passes over the
different items listed, but the end user hasn't yet "clicked/selected" any
specific item.  I know it can be done with a listbox.  Basically looking for
the  LB_ITEMFROMPOINT equivalent for Comboboxes.  Does anyone have any idea
how to accomplish this with a combobox?  Please help.

Author
22 Sep 2006 4:56 AM
Cor Ligthert [MVP]
Easton,

Any reason that you want to do this, it sound for me forever stupid that
people want to confrontate users with non standard behaviour. Something from
the 80's in the previous century.

Cor

Show quoteHide quote
"Easton" <Eas***@discussions.microsoft.com> schreef in bericht
news:5254EA53-028F-4A16-BD71-F925C4168C1D@microsoft.com...
> To anyone who might be able to help.
>
> I'm trying to derive the index of any random item in a populated combobox
> dropdownlist when the mousepointer is over the item.  Seems to me it
> should
> be possible since the item "highlights" when the mouse passes over the
> different items listed, but the end user hasn't yet "clicked/selected" any
> specific item.  I know it can be done with a listbox.  Basically looking
> for
> the  LB_ITEMFROMPOINT equivalent for Comboboxes.  Does anyone have any
> idea
> how to accomplish this with a combobox?  Please help.
Author
22 Sep 2006 12:53 PM
Easton
Yes, my application would use the index to derive a preview of information to
help the end user make the best possible choice from the combobox. 

Show quoteHide quote
"Cor Ligthert [MVP]" wrote:

> Easton,
>
> Any reason that you want to do this, it sound for me forever stupid that
> people want to confrontate users with non standard behaviour. Something from
> the 80's in the previous century.
>
> Cor
>
> "Easton" <Eas***@discussions.microsoft.com> schreef in bericht
> news:5254EA53-028F-4A16-BD71-F925C4168C1D@microsoft.com...
> > To anyone who might be able to help.
> >
> > I'm trying to derive the index of any random item in a populated combobox
> > dropdownlist when the mousepointer is over the item.  Seems to me it
> > should
> > be possible since the item "highlights" when the mouse passes over the
> > different items listed, but the end user hasn't yet "clicked/selected" any
> > specific item.  I know it can be done with a listbox.  Basically looking
> > for
> > the  LB_ITEMFROMPOINT equivalent for Comboboxes.  Does anyone have any
> > idea
> > how to accomplish this with a combobox?  Please help.
>
>
>
Author
22 Sep 2006 11:04 AM
Phill W.
Easton wrote:

> I'm trying to derive the index of any random item in a populated combobox
> dropdownlist when the mousepointer is over the item.  Seems to me it should
> be possible since the item "highlights" when the mouse passes over the
> different items listed, but the end user hasn't yet "clicked/selected" any
> specific item. 

If you create a Control derived from ComboBox, make it OwnerDrawn and
override the DrawItem method, you should be able to pick out the
currently "hovered" item based on each item's style.  (IIRC, the item's
index is passed as part of the Event Arguments).

Not something to take on lightly, but it you /really want to...

Regards,
    Phill  W.
Author
22 Sep 2006 12:56 PM
Easton
Thank you Phill,  I've been headed in that direction as well.  Would you
happend to know what event I should be watching?

Show quoteHide quote
"Phill W." wrote:

> Easton wrote:
>
> > I'm trying to derive the index of any random item in a populated combobox
> > dropdownlist when the mousepointer is over the item.  Seems to me it should
> > be possible since the item "highlights" when the mouse passes over the
> > different items listed, but the end user hasn't yet "clicked/selected" any
> > specific item. 
>
> If you create a Control derived from ComboBox, make it OwnerDrawn and
> override the DrawItem method, you should be able to pick out the
> currently "hovered" item based on each item's style.  (IIRC, the item's
> index is passed as part of the Event Arguments).
>
> Not something to take on lightly, but it you /really want to...
>
> Regards,
>     Phill  W.
>