Board index » cppbuilder » Using TListBox->TopIndex property instead of TListBox->Selected

Using TListBox->TopIndex property instead of TListBox->Selected

I have created a TListBox component that has a list of numbers from 1 to
10.  I want the user to be able to select a number just by scrolling the
box up or down, rather than actually highlighting a number.  So, I have
used the IntegralHeight property to show just one number at a time, and
then I use the TopIndex property to figure out which number is showing.
This works fine, except that the user can still click on a number and
highlight it (which I don't want him to be able to do).

I thought about placing a transparent panel overlaying the text portion
(items) of the TListBox allowing only the scroll up/down buttons to show
through, so as to intercept the user's click on the items.  Is this the
only way?  Intuitively, it seems to me that there must be an easier
approach.  Also, is there a way to specify that the user can only
select, say, 3 items in the listbox?  If there were a variable to
specify this, I could just set it to 0, and solve my problem that way.

Thanks

 

Re:Using TListBox->TopIndex property instead of TListBox->Selected


Hi., Victor!

A TEdit associated with a TUpDown probably does what you are looking
for. Have you tried that?

------
Mark Cashman (TeamB - C++ Builder), creator of The Temp{*word*203}Doorway at
http://www.temporaldoorway.com
- Original digital art, writing, music and more -
C++ Builder / JBuilder Tips and The C++ Builder Programmer's Webring
(Join us!)
http://www.temporaldoorway.com/programming/index.htm
------

Re:Using TListBox->TopIndex property instead of TListBox->Selected


Quote
"Victor Hannak" <han...@nospam.kodak.com> wrote in message

news:385A9BA9.A581BA2E@nospam.kodak.com...

Quote
> I have created a TListBox component that has a list of numbers from 1 to
> 10.  I want the user to be able to select a number just by scrolling the
> box up or down, rather than actually highlighting a number.
>   Is this the only way?

Hi Victor

I would use TUpDown. I saves reinventing the wheel.

len jones

Other Threads