First, the reason your combobox isn't displaying properly is because of the height of the control. For a combobox, the height also sets the size of the dropdown list, with the textfield part of the combobox getting set to a standard height (about 20 or so pixels). Also note that unless the -nointegraleheight option is given, the height of the dropdown list won't be exactly the amount you specify, as Windows will adjust the height to fit the contents, usually about 20 pixels per item. Depending on the number of items, you may also need to set the -vscroll option to display a vertical scrollbar.
As far as I know, you can't specify that a combobox opens its list upwards, Windows takes care of that, and I think would only open it upwards if there was no room beneath the control to display the list.
If you want an input box that restricts input, you could try the UpDown control, although this is limited to ranges of numerical data. The UpDown control is used to increment or decrement the value in its 'buddy' control. Here is an example of creating a UpDown control:
-name => "Text",
-size => [80,20],
-value => 0,
-name => "UpDown",
$win->UpDown->Range(0,20); #sets the range for the UpDown control
The UpDown control automatically selects the previous control in the z-order to be its buddy control, in this case the Textfield. Use the SetBuddy() function to change the buddy control if needed. Check the docs for more info.
Hope this has helped,
> From: kinch@...
> To: perl-win32-gui-users@...
> Date: Sat, 1 Aug 2009 21:05:52 +1000
> Subject: [perl-win32-gui-users] Comboboxes
> Hello again,
> I have a combobox sitting at the area at the bottom of the screen (in my
> app). I've added 4 items to it, and I can scroll through them fine when
> using the keyboard. However, if I use the mouse, the 'dropdown' part is
> about 1 pixel high, and I can't see the items.
> Here is my creation code:
> The $win window is the main window, but it's generally drawn maximised, so
> it seems I'll always have this problem.
> First off, is there any way to force the drop down list to open upwards?
> (Something tells me I'm hoping for the impossible with that one.) If that
> isn't possible, is there any way to have an input box that restricts users
> to certain inputs? I was ideally hoping for one of those little things with
> the up/down arrows (like with the DateTime GUI object) but nothing I've seen
> so far indicates this is possible.
> Can anyone offer some guidance?
> Thank you in advance.
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> Perl-Win32-GUI-Users mailing list
Looking for a place to rent, share or buy this winter? Find your next place with Ninemsn property