LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulation of CTRL key holding with a Toggle Button

I know I can emulate a keyboard key press with FakeKeystroke( ) function.

But is there a way to simulate a key holding down (CTRL, or ALT for example)?

So that when the user left-click, a CTRL+left-click event is generated.

In a touch screen application the user can only generate a left-click event, so the modifier keyboards keys must be simulated.

 

I've been thinking about a Toggle Button representing the key pressed or not, but I don't know which function I should use inside the button callback.

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 1 of 4
(4,503 Views)

In the control callback you can test the value of the toggle button and decide what to do depending on its state:

 

case EVENT_LEFT_CLICK:

    GetCtrlVal (panel, PANEL_TOGGLEBUTTON, &sts);

    if (sts) {

        // Code for modifier key on

    }

    else {

        // Code for modifier key off

    }

    // If you want to turn off the modifier key:

    SetCtrlVal (panel, PANEL_TOGGLEBUTTON, 0);

    break;



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(4,498 Views)

Your suggestion seems OK, but the problem is a little bit more complicated.

I'd like using the movectrl function MakeMovableControl( ) without modifying the movectrl.fp source file, so I need to simulate a real CTRL holding, so that CTRL+left-click is sent to the control callbacks chained by MakeMovableControl( )...

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 3 of 4
(4,492 Views)

Oh, I see! This is a completely different scenario I didn't figured out...

I'm afraid I have no suggestion at the moment.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 4
(4,489 Views)