Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Use Menu with Combo?(Is it possible to use a Menu widget instead of the usual setItems with the Combo widget?)
Use Menu with Combo? [message #636580] Tue, 02 November 2010 02:24 Go to next message
Jonah Bron is currently offline Jonah BronFriend
Messages: 32
Registered: October 2010
Location: California
Member
Hello, world!

Is it possible to use a Menu widget on a Combo instead of the usual addItems() method? Or otherwise, how can I add separators to the Combo dropdown? Menu would be better because I can associate an Object with each item.

Thanks!

[Updated on: Tue, 02 November 2010 02:27]

Report message to a moderator

Re: Use Menu with Combo? [message #636704 is a reply to message #636580] Tue, 02 November 2010 13:51 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Hi,

There isn't a way to do this for Combos, I don't know if the native controls
provide support for separators like this.

If this is important then a workaround you can try is to create a ToolBar
with a SWT.DROP_DOWN ToolItem, and provide the menu (which can contain a
separator) when needed. For an example of this see
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org. eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet67. java .

Grant


"Jonah Bron" <jonah@nucleussystems.com> wrote in message
news:iansia$95i$1@news.eclipse.org...
> Hello, world!
>
> Is it possible to use a Menu widget on a Combo instead of the usual
> addItems() method? Or otherwise, how can I add separators to the Combo
> dropdown?
>
> Thanks!
> --
> Premature developer
Re: Use Menu with Combo? [message #636773 is a reply to message #636580] Tue, 02 November 2010 17:48 Go to previous messageGo to next message
Jonah Bron is currently offline Jonah BronFriend
Messages: 32
Registered: October 2010
Location: California
Member
Hm, I don't know if that will work for my application. Is there any way to set an item in the Combo as non-selectable?
Re: Use Menu with Combo? [message #636958 is a reply to message #636773] Wed, 03 November 2010 14:12 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
No, there isn't a way to do this. But a menu item can be disabled ;-).

Grant


"Jonah Bron" <jonah@nucleussystems.com> wrote in message
news:iapime$rl7$1@news.eclipse.org...
> Hm, I don't know if that will work for my application. Is there any way
> to set an item in the Combo as non-selectable?
> --
> Premature developer
Previous Topic:Correct way to use Listeners
Next Topic:How to Group text color
Goto Forum:
  


Current Time: Fri Apr 26 13:31:04 GMT 2024

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

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

Back to the top