11-25-2010 07:41 AM
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.
11-25-2010 09:25 AM
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;
11-25-2010 09:40 AM
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( )...
11-25-2010 10:01 AM
Oh, I see! This is a completely different scenario I didn't figured out...
I'm afraid I have no suggestion at the moment.