[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: 2 same mnemonics on the same screen at the same time
|
It's up to the OS to handle this case, but I think they usually do what you
want (iterate through the matches). I see this on win2000 with the snippet
below:
public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell (display);
Menu bar = new Menu (shell, SWT.BAR);
shell.setMenuBar (bar);
for (int i = 0; i < 3; i++) {
MenuItem fileItem = new MenuItem (bar, SWT.CASCADE);
fileItem.setText ("&File");
Menu submenu = new Menu (shell, SWT.DROP_DOWN);
fileItem.setMenu (submenu);
MenuItem item = new MenuItem (submenu, SWT.PUSH);
item.addListener (SWT.Selection, new Listener () {
public void handleEvent (Event e) {
System.out.println ("Select All");
}
});
item.setText ("Select &All\tCtrl+A");
item.setAccelerator (SWT.MOD1 + 'A');
}
shell.setSize (200, 200);
shell.open ();
while (!shell.isDisposed()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
Grant
"hao" <d95776@xxxxxxxxx> wrote in message
news:396293d78e04c03e46c1677add793717$1@xxxxxxxxxxxxxxxxxx
> I have 2 same mnemonics (for example, alt-P) on the same screen at the
> same time. How could I order them such that the first hit of alt-P reaches
> the first control and second hit of alt-P reaches the second contrl?
>
> thanks
> hao
>