LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Twin functionalities for menu ring

Solved!
Go to solution

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 ?

0 Kudos
Message 1 of 5
(1,558 Views)
Solution
Accepted by topic author gdargaud

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

0 Kudos
Message 2 of 5
(1,536 Views)

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 ?

0 Kudos
Message 3 of 5
(1,521 Views)

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

0 Kudos
Message 4 of 5
(1,514 Views)

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 ];

...

0 Kudos
Message 5 of 5
(1,484 Views)