01-05-2006 04:37 PM
int CVICALLBACK go_cmd (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
char
switch (event)
{
case EVENT_KEYPRESS:
input = eventData1;
//if (eventData1 = 'a')
//InsertTextBoxLine (panelHandle, PANEL_CMD, gLine, "A");
SetCtrlVal (panelHandle, PANEL_CMD, input_char);
/*switch (eventData1)
{
case 'a':
InsertTextBoxLine (panelHandle, PANEL_CMD, gLine++, "A");
//SetCtrlVal (panelHandle, PANEL_CMD, "A");
break;
case VAL_DOWN_ARROW_VKEY:
QuitUserInterface(0);
break;
case VAL_ENTER_VKEY:
enter_pressed();
break;
default:
break;
}
*/
}
return 0;
}
01-05-2006 05:08 PM
I couldn't find a way to delete a thread that i posted.
Problem is solved using fmt. please disregard my prev thread. thanks.
Justin
01-05-2006 05:18 PM - edited 01-05-2006 05:18 PM
Sorry, duplicated post!
Message Edited by Roberto Bozzolo on 01-06-2006 12:19 AM
01-05-2006 05:18 PM - edited 01-05-2006 05:18 PM
Sorry, duplicated post!
Message Edited by Roberto Bozzolo on 01-06-2006 12:19 AM
01-05-2006 05:18 PM - edited 01-05-2006 05:18 PM
Justinlee, detecting the keys hit by the user is a little bit more complicated than you imagine. I suggest that you studi keyfiltr.prj sample located in <cvidir>\samples\userint to undestand how keyboard events are treated in control callbacks. As you can see in the code:
/* eventData1 contains the keypress value represented as a 4-byte */
/* integer consisting of 3 fields, 0x00MMVVAA: */
/* MM = the modifier key */
/* VV = the virtual key, masks defined in userint.h */
/* AA = the ASCII key */
/* eventData2 is a pointer to an integer which holds the actual key */
/* value. This pointer can be used to change the value of the key */
/* before the control processes it. */
asciiCode = eventData1 & VAL_ASCII_KEY_MASK;
virtualKey = eventData1 & VAL_VKEY_MASK;
modifierKey = eventData1 & VAL_MODIFIER_KEY_MASK;
Message Edited by Roberto Bozzolo on 01-06-2006 12:21 AM