On Sun, 25 Aug 2019 04:14:05 -0700 (PDT) Ian McInerney wrote:
IM> The main reason I wish to add the event source to the menu events is the
IM> following workflow:
IM> You have a menu item that opens a selection window for a new object to add
IM> to a drawing display. You want this selection window to be activated by
IM> either the keyboard (through accelerator keys) or the menu item, but you
IM> want some different behavior with each.
OK, this makes sense, thanks. But I think we agree that the "accelerator"
behaviour should actually also happen if you use Alt-X,Y to open the menu
(where "X" and "Y" are the mnemonics of the menu and menu item
respectively), i.e. it only matters whether the keyboard or the mouse was
used for performing the action, doesn't it?
The annoying thing is that this is clearly related to what MSW already
does with WM_XXXUISTATE messages, which track exactly this (see
https://devblogs.microsoft.com/oldnewthing/20130516-00/?p=4343 for a good
explanation), but I'm not sure if we can somehow reuse this here: while
WM_QUERYUISTATE looks useful, I'm not sure if it's really what we need.
IM> I guess since the EVT_TOOL and EVT_MENU command events are the same, it
IM> would make sense to add a toolbar source, since the same handler could be
IM> linked to both events (and it is possible to want the same workflow
IM> described above with a toolbar button as well). That would simplify the
IM> user-level handling logic.
IM>
IM> So then the event sources would be:
IM> UNSPECIFIED
IM> MENU_CLICK
IM> TOOL_CLICK
IM> ACCEL_KEY
Actually, and contrary to what I wrote in the previous reply, before
understanding the context of this change, I now think it's not really
useful to distinguish between the menu and toolbar items here. For me the
possibilities should rather be something like UNKNOWN, KEYBOARD, MOUSE.
However, and especially if we can reuse WM_QUERYUISTATE, which doesn't
provide such detailed information, in wxMSW implementation, perhaps the
best API would actually be something like WasLastActionPerformedFromKbd()
in wxTLW.
Sorry for making this more complicated,
VZ