Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Setting visible items count in Combo dynamically(Setting visible items count in Combo dynamically)
Setting visible items count in Combo dynamically [message #541329] Sun, 20 June 2010 03:24 Go to next message
Eclipse UserFriend
We have a requirement to set the visible items count in combo dynamically depending on the screen resolution and the size. So that the visible items in the combo will always fit in the screen with both the ends of the combo visible with scroll buttons. Can anyone tell me if this could be done and how?
Re: Setting visible items count in Combo dynamically [message #541729 is a reply to message #541329] Tue, 22 June 2010 07:07 Go to previous messageGo to next message
Eclipse UserFriend
Hi Supreetha,

You could compute the number of items and set it to the combo using setVisibleItemCount().

You can do something like this:
Rectangle rect = display.getClientArea();
int itemCount = rect.height/combo.getItemHeight();
combo.setVisibleItemCount(itemCount);

If you want the dropdown items to be shown only below the combo then you can compute it based on the position of the combo.
Point point = display.map(null, combo, rect.width, rect.height);
itemCount = (point.y - combo.getTextHeight())/combo.getItemHeight();

HTH,
Re: Setting visible items count in Combo dynamically [message #542843 is a reply to message #541729] Sat, 26 June 2010 13:32 Go to previous message
Eclipse UserFriend
thanku
Previous Topic:Disable editing checkboxes in a Table
Next Topic:How to disable key binding Ctrl+i in StyledText control
Goto Forum:
  


Current Time: Sun Aug 31 02:28:36 EDT 2025

Powered by FUDForum. Page generated in 0.02984 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top