Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Drop-down button in toolbar
Drop-down button in toolbar [message #329407] Mon, 23 June 2008 09:00 Go to next message
Eclipse UserFriend
I would like to have a drop-down button in my main toolbar, so I used
style="pulldown" on a <command> declared in the toolbar. Works ok, except...

I want the button to always show its drop-down menu when it's clicked,
not just when it's clicked on the arrow. This seems impossible because
when the button is clicked on its icon, it just executes its associated
command and doesn't show the drop-down menu at all.

So I used a <control> instead, implemented it with a Button, and wrote a
bit of code to render a menu underneath it. Not too bad, but a Button is
always rendered with a border, unlike ToolItems, so now it looks odd.

Any tips on how to fix either of my approaches, or perhaps a better
alternative?

Thanks.
Re: Drop-down button in toolbar [message #329425 is a reply to message #329407] Mon, 23 June 2008 13:54 Go to previous message
Eclipse UserFriend
Jasper wrote:
> I would like to have a drop-down button in my main toolbar, so I used
> style="pulldown" on a <command> declared in the toolbar. Works ok,
> except...
>
> I want the button to always show its drop-down menu when it's clicked,
> not just when it's clicked on the arrow. This seems impossible because
> when the button is clicked on its icon, it just executes its associated
> command and doesn't show the drop-down menu at all.

The behaviour you described is the correct dropdown behaviour (that's
how it is supposed to work :-)

However, it might be possible for your to hack something together yourself.

Useful bits of information.

1) in 3.4 you can use menuContribution/dynamic to specify *any* class
based on ContributionItem

2) Check out how CommandContributionItem handles a selection event in
org.eclipse.ui.menus.CommandContributionItem.openDropDownMen u(Event).
An event.detail == 4 is what we used to detect the arrow was clicked.
If you didn't check, you could open the menu on any selection event (not
just the arrow).

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
Previous Topic:view toolbar not show or in wrong place
Next Topic:Internationalization of a Plugin
Goto Forum:
  


Current Time: Thu May 01 13:51:38 EDT 2025

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

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

Back to the top