Fixing Menu keyboard navigation
|Reported by:||Pete||Owned by:||X512|
While working on PopUpMenu, I noticed that there were several problems with menu keyboard navigation. These included the difficulties described in #4594, but are more extensive, so I'm filing a new ticket rather than extending that one. Hope that's the approved procedure. I'm attaching a patch which seems to fix everything, but please check it independently and extensively!
The bugs were:
1) Using Enter or Space to select an item would Invoke() an attached message, but never returned a pointer to the item if the app was waiting for it.
2) Sub-menus were not reachable via the left and right arrow keys. The _Track method would just hang in the loop that waited for mouse movement.
3) MenuBar suffered from problems similar to the above, causing #4594.
(1) was a result of fSelected being cleared before it could be returned to the caller. I solved this by using fChosenItem, which perviously was only needed by MenuBar.
(2) needed passing some extra MENU_STATE_... values around -- added to MenuPrivate.h.
(3) was cured by applying similar mods to MenuBar.