java - Menu accelerator SWT.ALT+SWT.ARROW is not triggered -
i'm using swt 4.4.2 (win32) build graphical user interface simple mp3 player application.
in swt tree show folders , files play.
want change volume of playing file clicking menu item , pressing alt+arrow_up , alt+arrow_down.
so have these components:
tree = new tree(shell, swt.border | swt.full_selection | swt.single | swt.v_scroll); tree.setlinesvisible(true); tree.setlocation(10, 10); tree.setsize(240, 440); audioloudermenu = new menuitem(audiovolumemenu, swt.push); audioloudermenu.setaccelerator(swt.alt | swt.arrow_up); audioloudermenu.settext("louder"); audioloudermenu.addlistener(swt.selection, audiovolumemenuhandler); audioquietermenu = new menuitem(audiovolumemenu, swt.push); audioquietermenu.setaccelerator(swt.alt | swt.arrow_down); audioquietermenu.settext("quieter"); audioquietermenu.addlistener(swt.selection, audiovolumemenuhandler);
the problem if tree view has focus , press alt+arrow_down entry in tree selected , not shortcut of menu item triggered.
is bug of swt , how can solve problem? know can define shortcut think should possible use alt+arrow_up/down...
this isn't bug (platform-dependant) keyboard navigation feature of tree.
i recommend choose different shortcut audio volume in order not confuse users. if nonetheless want use alt+arrow_down, can try prevent tree consuming key combination , give menu chance consume it:
tree.addlistener( swt.keydown, new listener() { @override public void handleevent( event event ) { if( event.keycode == swt.arrow_down && ( event.statemask & swt.mod3 ) != 0 ) { event.doit = false; } } } );
Comments
Post a Comment