summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2002-01-08 15:40:15 (GMT)
committerdrh <drh@noemail.net>2002-01-08 15:40:15 (GMT)
commitc972f8e5a09e1e9f7552f6725f44b3b14bfe739b (patch)
treea40636d7f96d656c762f41097edef5cedf491d9c /win
parent5323137e07c287120fe2fda388da978498181ac1 (diff)
downloadtk-c972f8e5a09e1e9f7552f6725f44b3b14bfe739b.zip
tk-c972f8e5a09e1e9f7552f6725f44b3b14bfe739b.tar.gz
tk-c972f8e5a09e1e9f7552f6725f44b3b14bfe739b.tar.bz2
Fix the following bug: If you select an entry on a cascade menu (on Win32)
then the next time the parent menu is posted, the cascade entry appears active. Also, if you traverse to a disabled menu entry using keystrokes and press ENTER on the disabled entry, then that entry appears active the next time the menu is posted. The same patch fixes both problems. FossilOrigin-Name: 6069b52dd4b62ea9164bafee3e456a57b216b213
Diffstat (limited to 'win')
-rw-r--r--win/tkWinMenu.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index f1c07d7..c814cda 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinMenu.c,v 1.17 2001/11/27 04:36:18 drh Exp $
+ * RCS: @(#) $Id: tkWinMenu.c,v 1.18 2002/01/08 15:40:15 drh Exp $
*/
#define OEMRESOURCE
@@ -913,6 +913,7 @@ TkWinHandleMenuEvent(phwnd, pMessage, pwParam, plParam, plResult)
(ClientData) menuPtr);
ReconfigureWindowsMenu((ClientData) menuPtr);
}
+ RecursivelyClearActiveMenu(menuPtr);
if (!tsdPtr->inPostMenu) {
Tcl_Interp *interp;
int code;
@@ -1079,6 +1080,12 @@ TkWinHandleMenuEvent(phwnd, pMessage, pwParam, plParam, plResult)
TkActivateMenuEntry(menuPtr, -1);
}
} else {
+ /* On windows, menu entries should highlight even if they
+ ** are disabled. (I know this seems dumb, but it is the way
+ ** native windows menus works so we ought to mimic it.)
+ ** The ENTRY_PLATFORM_FLAG1 flag will indicate that the
+ ** entry should be highlighted even though it is disabled.
+ */
if (itemPtr->itemState & ODS_SELECTED) {
mePtr->entryFlags |= ENTRY_PLATFORM_FLAG1;
} else {
@@ -1146,6 +1153,7 @@ TkWinHandleMenuEvent(phwnd, pMessage, pwParam, plParam, plResult)
Tcl_ServiceAll();
}
}
+ break;
}
}
return returnResult;
@@ -1178,6 +1186,10 @@ RecursivelyClearActiveMenu(
MenuSelectEvent(menuPtr);
for (i = 0; i < menuPtr->numEntries; i++) {
mePtr = menuPtr->entries[i];
+ if (mePtr->state == ENTRY_ACTIVE) {
+ mePtr->state = ENTRY_NORMAL;
+ }
+ mePtr->entryFlags &= ~ENTRY_PLATFORM_FLAG1;
if (mePtr->type == CASCADE_ENTRY) {
if ((mePtr->childMenuRefPtr != NULL)
&& (mePtr->childMenuRefPtr->menuPtr != NULL)) {