Hello!
Does anyone know if there's a way to determine the source of a wxCommandEvent that could have been either triggered from the menu itself or via an accelerator shortcut?
I know the Windows API has that info, but does it make it down to the wxWidgets events?
Thank you!
- Alejandro
Event source: menu vs accelerator
Re: Event source: menu vs accelerator
Hi,
What problem you are trying to solve?
This would be a very ugly feature. The handler should work the same way independently of user action. Otherwise you user will complain about that.
Thank you.
What problem you are trying to solve?
This would be a very ugly feature. The handler should work the same way independently of user action. Otherwise you user will complain about that.
Thank you.
Re: Event source: menu vs accelerator
It's for handling the paste action. We'd like the paste position to follow the mouse cursor when using the shortcut (and not when using the menu). And I can't just look at the cursor in the handler because the menu could have been overlapping the document area.
Thank you!
- Alejandro
Re: Event source: menu vs accelerator
The information is not accessible through the wxEvent class. I'd suggest to just use two different IDs.
Or - as a quick and dirty solution - you could check for the status of the CTRL key, which is probably still down when the keyboard shortcut was used.
https://docs.wxwidgets.org/trunk/group_ ... 41b71ce84f
Or - as a quick and dirty solution - you could check for the status of the CTRL key, which is probably still down when the keyboard shortcut was used.
https://docs.wxwidgets.org/trunk/group_ ... 41b71ce84f
Use the source, Luke!
Re: Event source: menu vs accelerator
This worked, thank you again!!doublemax wrote: ↑Wed Mar 31, 2021 5:44 pm Or - as a quick and dirty solution - you could check for the status of the CTRL key, which is probably still down when the keyboard shortcut was used.
https://docs.wxwidgets.org/trunk/group_ ... 41b71ce84f
- Alejandro