diff options
author | drh <drh@sqlite.org> | 2002-01-08 15:40:15 (GMT) |
---|---|---|
committer | drh <drh@sqlite.org> | 2002-01-08 15:40:15 (GMT) |
commit | 25763c453c7b11724ebbae222c63fec2071873f4 (patch) | |
tree | a40636d7f96d656c762f41097edef5cedf491d9c /win | |
parent | 48c6fa2596567056e76570fccffb1b23e54626b4 (diff) | |
download | tk-25763c453c7b11724ebbae222c63fec2071873f4.zip tk-25763c453c7b11724ebbae222c63fec2071873f4.tar.gz tk-25763c453c7b11724ebbae222c63fec2071873f4.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')
-rw-r--r-- | win/tkWinMenu.c | 14 |
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)) { |