Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Hide items in a combo box

891 views
Skip to first unread message

creek

unread,
Oct 22, 2007, 8:22:23 AM10/22/07
to
Hi,
is it possible to hide items in a combo box in Delphi 2006? I have a combo
box with 4 items and I would like to hide/show 2 of them at run-time. What
I really want is to preserve the items' indices (from 0 to 3) through all
the program execution.

Thanks,
Bye.

--- posted by geoForum on http://delphi.newswhat.com

Wayne Niddery (TeamB)

unread,
Oct 22, 2007, 11:10:02 AM10/22/07
to
"creek" <creek...@yahoo.it> wrote in message
news:471c8b02$1...@newsgroups.borland.com...

> is it possible to hide items in a combo box in Delphi 2006? I have a combo
> box with 4 items and I would like to hide/show 2 of them at run-time. What
> I really want is to preserve the items' indices (from 0 to 3) through all
> the program execution.


That functionality is not available in a combobox (which is a Windows
control).

However, you can easily work around the index issue: rather than depending
on the Combobox's ItemIndex, store your own index in the Objects property of
each item, or alternatively (if you need the Objects property for something
else), keep the complete list of items in a separate StringList and then
look up the selected item in that list to get its index.

--
Wayne Niddery - Winwright, Inc. (www.winwright.ca)

0 new messages