11-29-2022 04:13 AM
Hello, hello,
I would like to do something similar to this:
- have a normal menu ring
- if user clicks on one of the items, I do something with it (GetCtrlVal in the callback as usual)
- if the user right-click on one of the items, I do something else.
But right-click events do no happen on items, only on the control itself (before the selection).
I don't see an easy way out.
I'm about to duplicate the control to have the 2 functionalities entirely separate, unless someone has a brighter idea ?
Solved! Go to Solution.
11-29-2022 05:20 AM
Hello,
maybe you could consider using Shift (or Ctrl or Alt) plus Left Click as an alternative? Within your left click event code you then would query the key modifier states (GetKeyboardState)
Best,
Wolfgang
11-29-2022 08:25 AM
Seems like a good idea; I don't often think of using modifier keys.
But where is that function, I don't find it in CVI. Is that a WinAPI function ?
11-29-2022 08:48 AM
In my EVENT_COMMIT, I used GetGlobalMouseState(NULL, NULL, NULL, NULL, NULL, &Modifier) in conjunction with VAL_MENUKEY_MODIFIER, VAL_UNDERLINE_MODIFIER, VAL_SHIFT_MODIFIER or VAL_SHIFT_AND_MENUKEY
11-29-2022 11:24 AM
Hello,
sorry I forgot to mention it, this function is defined in WinUser.h (provided with CVI) and I use it as follows:
BYTE virtual_keys [ 256 ] = "";
if ( GetKeyboardState ( virtual_keys ) )
{
BYTE alt = virtual_keys [ VK_MENU ];
BYTE ctrl = virtual_keys [ VK_CONTROL ];
BYTE shift = virtual_keys [ VK_SHIFT ];
...