i need to handle arrow key presses .
I am not sure about what callback to use.
Pt_CB_HotKey??
Pt_CB_RAW??
Can any one tell with a small example
i need to handle arrow key presses .
I am not sure about what callback to use.
Pt_CB_HotKey??
Pt_CB_RAW??
Can any one tell with a small example
Though i figured out to use Pt_CB_RAW
I try to restrict the key press to the down arrow key… I just need to take an action only when the down arrow key are pressed.
here is some code
int keycheck( PtWidget_t *pwgt, void *pvData, PtCallbackInfo_t *ptsInfo )
{
PhEvent_t *event = ptsInfo ? ptsInfo->event : NULL;
PhKeyEvent_t *keyevent = event ? (PhKeyEvent_t *)PhGetData(event):NULL;
//this handles all key presses… set it only for down
if(event && (event->type & Ph_EV_KEY) && (keyevent->key_cap & Pk_Down))
printf("\n down key press");
return ( Pt_CONTINUE );
}
But when i run this code. this code prints the value on all key presses. I want to restrict the print only when down key is pressed.
Thanks
PhKeyEvent_t *key_ev;
key_ev = (PhKeyEvent_t *)PhGetData( cbinfo->event );
if (key_ev->key_flags & Pk_KF_Cap_Valid)
switch ( key_ev->key_cap )
{
// --------- UP ARROW -----------
case 0xF052:
if ( key_ev->key_flags & (Pk_KF_Key_Down | Pk_KF_Key_Repeat))
{
// KEY press and repeat
}
else
if ( (key_ev->key_flags & 0x0F)== 0)
{
// key unpress
}
break;
}
Hi
Now i just want to handle the printable keys.
I want to take just one action whenever any of the printable keys are pressed.
Is there a way to do it?
or will have to switch case for all possible cases.
Thanks