diff options
author | Steve Northover <steve> | 2006-02-10 23:28:44 +0000 |
---|---|---|
committer | Steve Northover <steve> | 2006-02-10 23:28:44 +0000 |
commit | 17574985c616be66236af1d5f93a04eefca88051 (patch) | |
tree | 8109d71c5e4a24003050dce548aa7f3e040c1f3c | |
parent | fe5255873889e549d846c2b2208ae0cf859acfd4 (diff) | |
download | eclipse.platform.swt-17574985c616be66236af1d5f93a04eefca88051.tar.gz eclipse.platform.swt-17574985c616be66236af1d5f93a04eefca88051.tar.xz eclipse.platform.swt-17574985c616be66236af1d5f93a04eefca88051.zip |
80913 - TabFolder no longer sets focus to tab when mnemonic pressed
4 files changed, 29 insertions, 33 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/tabfolder/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/tabfolder/org/eclipse/swt/widgets/TabFolder.java index 55535aa557..a0cb342a99 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/tabfolder/org/eclipse/swt/widgets/TabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/emulated/tabfolder/org/eclipse/swt/widgets/TabFolder.java @@ -804,11 +804,11 @@ Point minimumSize (int wHint, int hHint, boolean flushCache) { } boolean mnemonicHit (char key) { for (int i = 0; i < items.length; i++) { - if (i != selectedIndex) { - char mnemonic = getMnemonic (items[i].getText ()); - if (mnemonic != '\0') { - if (Character.toUpperCase (key) == Character.toUpperCase (mnemonic)) { - setSelection(i, true); + char mnemonic = getMnemonic (items[i].getText ()); + if (mnemonic != '\0') { + if (Character.toUpperCase (key) == Character.toUpperCase (mnemonic)) { + if (forceFocus ()) { + if (i != selectedIndex) setSelection(i, true); return true; } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java index eaa73773f6..a0ba45a6d3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java @@ -476,24 +476,18 @@ Point minimumSize (int wHint, int hHint, boolean flushCache) { boolean mnemonicHit (char key) { int itemCount = getItemCount (); - int selection = getSelectionIndex (); for (int i=0; i<itemCount; i++) { - if (i != selection) { - int /*long*/ labelHandle = items [i].labelHandle; - if (labelHandle != 0 && mnemonicHit (labelHandle, key)) return true; - } + int /*long*/ labelHandle = items [i].labelHandle; + if (labelHandle != 0 && mnemonicHit (labelHandle, key)) return true; } return false; } boolean mnemonicMatch (char key) { int itemCount = getItemCount (); - int selection = getSelectionIndex (); for (int i=0; i<itemCount; i++) { - if (i != selection) { - int /*long*/ labelHandle = items [i].labelHandle; - if (labelHandle != 0 && mnemonicHit (labelHandle, key)) return true; - } + int /*long*/ labelHandle = items [i].labelHandle; + if (labelHandle != 0 && mnemonicHit (labelHandle, key)) return true; } return false; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java index 6f4299ce96..22aadf0309 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java @@ -2821,14 +2821,12 @@ boolean translateMnemonic (MSG msg) { } boolean translateTraversal (MSG msg) { + int hwnd = msg.hwnd; int key = msg.wParam; if (key == OS.VK_MENU) { - Shell shell = getShell (); - int hwndShell = shell.handle; - OS.SendMessage (hwndShell, OS.WM_CHANGEUISTATE, OS.UIS_INITIALIZE, 0); + OS.SendMessage (hwnd, OS.WM_CHANGEUISTATE, OS.UIS_INITIALIZE, 0); return false; } - int hwnd = msg.hwnd; int detail = SWT.TRAVERSE_NONE; boolean doit = true, all = false; boolean lastVirtual = false; @@ -2937,8 +2935,7 @@ boolean translateTraversal (MSG msg) { Control control = this; do { if (control.traverse (event)) { - int hwndShell = shell.handle; - OS.SendMessage (hwndShell, OS.WM_CHANGEUISTATE, OS.UIS_INITIALIZE, 0); + OS.SendMessage (hwnd, OS.WM_CHANGEUISTATE, OS.UIS_INITIALIZE, 0); return true; } if (!event.doit && control.hooks (SWT.Traverse)) return false; @@ -3054,7 +3051,11 @@ boolean traverseItem (boolean next) { } boolean traverseMnemonic (char key) { - return mnemonicHit (key); + if (mnemonicHit (key)) { + OS.SendMessage (handle, OS.WM_CHANGEUISTATE, OS.UIS_INITIALIZE, 0); + return true; + } + return false; } boolean traversePage (boolean next) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java index bbcc673eb8..c514441a3c 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java @@ -492,17 +492,14 @@ Point minimumSize (int wHint, int hHint, boolean flushCache) { } boolean mnemonicHit (char key) { - int selection = getSelectionIndex (); for (int i=0; i<items.length; i++) { - if (i != selection) { - TabItem item = items [i]; - if (item != null) { - char ch = findMnemonic (item.getText ()); - if (Character.toUpperCase (key) == Character.toUpperCase (ch)) { - if (setFocus ()) { - setSelection (i, true); - return true; - } + TabItem item = items [i]; + if (item != null) { + char ch = findMnemonic (item.getText ()); + if (Character.toUpperCase (key) == Character.toUpperCase (ch)) { + if (forceFocus ()) { + if (i != getSelectionIndex ()) setSelection (i, true); + return true; } } } @@ -704,7 +701,11 @@ boolean traversePage (boolean next) { index = (index + offset + count) % count; } setSelection (index, true); - return index == getSelectionIndex (); + if (index == getSelectionIndex ()) { + OS.SendMessage (handle, OS.WM_CHANGEUISTATE, OS.UIS_INITIALIZE, 0); + return true; + } + return false; } int widgetStyle () { |