Board index » delphi » detecting combobox list item selection change

detecting combobox list item selection change

  Hi All,

    Can anyone tell me how to detect when the item selection in the dropdown
list of a combobox has changed?

    The text items in my dropdown list are much longer than the width of the
combobox, so i want to display a hint window containing the text as the user
scrolls through the list.

  Failing that,  is it possible to get a horizontal scrollbar in the dropdown
list?

  Any help would be appreciated!

  Regards,

     Matt

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum

 

Re:detecting combobox list item selection change


This sounds like a tough one.  Let me say - I'm not sure, I haven't done
something like this before.

Couldn't you define a new class for the list items, and then declare a
OnShowHint event for them?  By activating this event and setting each
object's Hint property to it's label, I'm sure you can display the labels
like this.

Hope it works!  Please let us know if it did!!

Digit

Quote
shadi...@my-dejanews.com wrote in message

<6ov2nm$u5...@nnrp1.dejanews.com>...
Quote
>  Hi All,

>    Can anyone tell me how to detect when the item selection in the
dropdown
>list of a combobox has changed?

>    The text items in my dropdown list are much longer than the width of
the
>combobox, so i want to display a hint window containing the text as the
user
>scrolls through the list.

>  Failing that,  is it possible to get a horizontal scrollbar in the
dropdown
>list?

>  Any help would be appreciated!

>  Regards,

>     Matt

>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum

Re:detecting combobox list item selection change


  Digit,

  I've cracked it!  By making the combobox owner draw and setting a custom
hint to the currently drawn item text, but only if it's Owner draw state is
odSelected.  A bit of a mouthful I know but I think you'll get the jist!

  I don't know why I didn't think of this before.  I can now apply the same
principle to the DrawItem function and get it to fire an event when the
currently selected item is being drawn - yet another component in the
pipeline!

  Matt

In article <6p04lj$cn...@reader1.wxs.nl>,
  "de Villiers" <devilli...@wxs.nl> wrote:

Quote
> This sounds like a tough one.  Let me say - I'm not sure, I haven't done
> something like this before.

> Couldn't you define a new class for the list items, and then declare a
> OnShowHint event for them?  By activating this event and setting each
> object's Hint property to it's label, I'm sure you can display the labels
> like this.

> Hope it works!  Please let us know if it did!!

> Digit

> shadi...@my-dejanews.com wrote in message
> <6ov2nm$u5...@nnrp1.dejanews.com>...
> >  Hi All,

> >    Can anyone tell me how to detect when the item selection in the
> dropdown
> >list of a combobox has changed?

> >    The text items in my dropdown list are much longer than the width of
> the
> >combobox, so i want to display a hint window containing the text as the
> user
> >scrolls through the list.

> >  Failing that,  is it possible to get a horizontal scrollbar in the
> dropdown
> >list?

> >  Any help would be appreciated!

> >  Regards,

> >     Matt

> >-----== Posted via Deja News, The Leader in Internet Discussion ==-----
> >http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum

Re:detecting combobox list item selection change


Quote
In article <6ov2nm$u5...@nnrp1.dejanews.com>, shadi...@my-dejanews.com writes:
>    Can anyone tell me how to detect when the item selection in the dropdown
>list of a combobox has changed?

>    The text items in my dropdown list are much longer than the width of the
>combobox, so i want to display a hint window containing the text as the user
>scrolls through the list.

>  Failing that,  is it possible to get a horizontal scrollbar in the dropdown
>list?

>  Any help would be appreciated!

Why not put a ComboBox1.Width := WideEnough; in the OnDropDown event and a
ComboBox1.Width := Narrow in both the OnExit and OnChange event hsndlers.

Alan Lloyd
alangll...@aol.com

Other Threads