summaryrefslogtreecommitdiffstats
path: root/win/tkWinMenu.c
diff options
context:
space:
mode:
authordrh@sqlite.org <drh>2002-01-08 15:40:15 (GMT)
committerdrh@sqlite.org <drh>2002-01-08 15:40:15 (GMT)
commitd5f19c59bd34f94ff93f39ca115cce19f9718d53 (patch)
treea40636d7f96d656c762f41097edef5cedf491d9c /win/tkWinMenu.c
parent31629ec3b505170bcac0c3913e377132b4df027c (diff)
downloadtk-d5f19c59bd34f94ff93f39ca115cce19f9718d53.zip
tk-d5f19c59bd34f94ff93f39ca115cce19f9718d53.tar.gz
tk-d5f19c59bd34f94ff93f39ca115cce19f9718d53.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.
Diffstat (limited to 'win/tkWinMenu.c')
-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)) {