Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Button accelerators
Button accelerators [message #451867] Wed, 09 March 2005 22:41 Go to next message
Eclipse UserFriend
Originally posted by: nightwing812.gmail.com

Is there a simple way to add keyboard accelerators to buttons in swt? I
know that menuItem has as specific method, and I was wondering if there
was something similar for Button.

Brandon
Re: Button accelerators [message #451868 is a reply to message #451867] Wed, 09 March 2005 23:40 Go to previous messageGo to next message
Robert is currently offline RobertFriend
Messages: 45
Registered: July 2009
Member
Hi,

Indeed, there is no setAccelerator() for a Button. But perhaps something
like this will do the trick:

Button button = new Button(shell, SWT.PUSH);
button.setText("&My accelerator"); // note the &

On Windows, this sets the Alt+M accelerator, which causes the button to be
invoked when the user presses the Alt and 'M' key sequence. Not sure about
other platforms, though -- this is platform dependant.


Brandon Lynch wrote:

> Is there a simple way to add keyboard accelerators to buttons in swt? I
> know that menuItem has as specific method, and I was wondering if there
> was something similar for Button.

> Brandon
Re: Button accelerators [message #451887 is a reply to message #451868] Thu, 10 March 2005 16:22 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
This will work on all platforms.

Grant

"Robert" <robert_x20032000@yahoo.com> wrote in message
news:d0o1i0$p1l$1@www.eclipse.org...
> Hi,
>
> Indeed, there is no setAccelerator() for a Button. But perhaps something
> like this will do the trick:
>
> Button button = new Button(shell, SWT.PUSH);
> button.setText("&My accelerator"); // note the &
>
> On Windows, this sets the Alt+M accelerator, which causes the button to be
> invoked when the user presses the Alt and 'M' key sequence. Not sure about
> other platforms, though -- this is platform dependant.
>
>
> Brandon Lynch wrote:
>
> > Is there a simple way to add keyboard accelerators to buttons in swt? I
> > know that menuItem has as specific method, and I was wondering if there
> > was something similar for Button.
>
> > Brandon
>
>
Re: Button accelerators [message #451934 is a reply to message #451868] Thu, 10 March 2005 16:33 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
this will work on all platforms

"Robert" <robert_x20032000@yahoo.com> wrote in message
news:d0o1i0$p1l$1@www.eclipse.org...
> Hi,
>
> Indeed, there is no setAccelerator() for a Button. But perhaps something
> like this will do the trick:
>
> Button button = new Button(shell, SWT.PUSH);
> button.setText("&My accelerator"); // note the &
>
> On Windows, this sets the Alt+M accelerator, which causes the button to be
> invoked when the user presses the Alt and 'M' key sequence. Not sure about
> other platforms, though -- this is platform dependant.
>
>
> Brandon Lynch wrote:
>
> > Is there a simple way to add keyboard accelerators to buttons in swt? I
> > know that menuItem has as specific method, and I was wondering if there
> > was something similar for Button.
>
> > Brandon
>
>
Previous Topic:Tranparent label in a transparent shell
Next Topic:Reproducing Gdesklet look and feel ?
Goto Forum:
  


Current Time: Fri Oct 30 05:47:10 GMT 2020

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

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

Back to the top