ToolBar and Key Binding [message #443944] |
Mon, 04 October 2004 20:48 |
jmi Messages: 84 Registered: July 2009 |
Member |
|
|
Hello,
I've defined a ViewForm with a ToolBar in the top left.
I've put org.eclipse.jface.action.Action running with:
public class TestAction extends Action implements ISelectionChangedListener,
IDoubleClickListener {
public TestAction(final Composite myComposite) {
super();
setText("Test Action");
setAccelerator(SWT.CTRL | 'C');
//setText("Test@Ctrl+C");// Le key binding ne fonctionne pas
setToolTipText("Run the test action...");
setEnabled(true);
setImageDescriptor(ImageDescriptor.createFromURL(Util
.newURL("file:icons/folder.gif")));
}
...
In myComposite, i have:
ToolBarManager tbManager = createToolBarManager(SWT.HORIZONTAL |
SWT.FLAT);
ToolBar tb = tbManager.createControl(vf);
vf.setTopLeft(tb);
protected ToolBarManager createToolBarManager(final int style) {
// Create the manager
ToolBarManager manager = new ToolBarManager(style);
ActionContributionItem actionItem = new
ActionContributionItem(_testAction);
//actionItem.setMode(ActionContributionItem.MODE_FORCE_TEXT) ;
// Add an ActionContributionItem
manager.add(actionItem);
// Return the manager
return manager;
}
One button appears in the ToolBar and when you click on it, you have the
good result. So yyyeeeeessssssss everything is OK, my action is running.
Now, let's do CTRL+C ... and nothing happens!!!!!!
So, what's wrong????
There are Text widget in myComposite. Is the event consumed by a Widget???
Another thing, if i put some text in a Text widget, then i do CTRL+A [select
all], nothing is selected. So is it the rigth way?
Thanks
JMi
|
|
|
Re: ToolBar and Key Binding [message #444130 is a reply to message #443944] |
Thu, 07 October 2004 06:48 |
jmi Messages: 84 Registered: July 2009 |
Member |
|
|
Well, i've done it by adding the action in the main menu bar then with the
setComposite function, i modifiy the action of the panel (each panel
implements a custom interface IBaseAction with save, run, new...)... and
it runs.
JM Delsaux wrote:
> Hello,
> I've defined a ViewForm with a ToolBar in the top left.
> I've put org.eclipse.jface.action.Action running with:
> public class TestAction extends Action implements ISelectionChangedListener,
> IDoubleClickListener {
> public TestAction(final Composite myComposite) {
> super();
> setText("Test Action");
> setAccelerator(SWT.CTRL | 'C');
> //setText("Test@Ctrl+C");// Le key binding ne fonctionne pas
> setToolTipText("Run the test action...");
> setEnabled(true);
> setImageDescriptor(ImageDescriptor.createFromURL(Util
> .newURL("file:icons/folder.gif")));
> }
> ...
> In myComposite, i have:
> ToolBarManager tbManager = createToolBarManager(SWT.HORIZONTAL |
> SWT.FLAT);
> ToolBar tb = tbManager.createControl(vf);
> vf.setTopLeft(tb);
> protected ToolBarManager createToolBarManager(final int style) {
> // Create the manager
> ToolBarManager manager = new ToolBarManager(style);
> ActionContributionItem actionItem = new
> ActionContributionItem(_testAction);
> //actionItem.setMode(ActionContributionItem.MODE_FORCE_TEXT) ;
> // Add an ActionContributionItem
> manager.add(actionItem);
> // Return the manager
> return manager;
> }
> One button appears in the ToolBar and when you click on it, you have the
> good result. So yyyeeeeessssssss everything is OK, my action is running.
> Now, let's do CTRL+C ... and nothing happens!!!!!!
> So, what's wrong????
> There are Text widget in myComposite. Is the event consumed by a Widget???
> Another thing, if i put some text in a Text widget, then i do CTRL+A [select
> all], nothing is selected. So is it the rigth way?
> Thanks
> JMi
|
|
|
Powered by
FUDForum. Page generated in 0.02628 seconds