C
WORD BtnTranslateMsg( void * pObj, GOL_MSG * pMsg );
Overview
This function evaluates the message from a user if the message will affect the object or not. The table below enumerates the translated messages for each event of the touch screen and keyboard inputs.
Translated Message |
Input Source |
Set/Clear State Bit |
Description |
BTN_MSG_PRESSED |
Touch Screen |
EVENT_PRESS, EVENT_MOVE |
If events occurs and the x,y position falls in the face of the button while the button is not pressed. |
|
Keyboard |
EVENT_KEYSCAN |
If event occurs and parameter1 passed matches the object’s ID and parameter 2 passed matches SCAN_CR_PRESSED or SCAN_SPACE_PRESSED while the button is not pressed. |
BTN_MSG_STILLPRESSED |
Touch Screen |
EVENT_STILLPRESS |
If event occurs and the x,y position does not change from the previous press position in the face of the button. |
BTN_MSG_RELEASED |
Touch Screen |
EVENT_RELEASE |
If the event occurs and the x,y position falls in the face of the button while the button is pressed. |
|
Keyboard |
EVENT_KEYSCAN |
If event occurs and parameter1 passed matches the object’s ID and parameter 2 passed matches SCAN_CR_RELEASED or SCAN_SPACE_RELEASED while the button is pressed. |
BTN_MSG_CANCELPRESS |
Touch Screen |
EVENT_MOVE |
If the event occurs outside the face of the button and the button is currently pressed. |
OBJ_MSG_INVALID |
Any |
Any |
If the message did not affect the object. |
Input Parameters
Input Parameters |
Description |
void * pObj |
The pointer to the object where the message will be evaluated to check if the message will affect the object. |
GOL_MSG * pMsg |
Pointer to the message struct containing the message from the user interface. |
Returns
Preconditions
none
Side Effects
none
Example
void MyGOLMsg(GOL_MSG *pMsg){ OBJ_HEADER *pCurrentObj; WORD objMsg; if(pMsg->uiEvent == EVENT_INVALID) return; pCurrentObj = GOLGetList(); while(pCurrentObj != NULL){ // If the object must be redrawn // It cannot accept message if(!IsObjUpdated(pCurrentObj)){ translatedMsg = pCurrentObj->MsgObj(pCurrentObj, pMsg); if(translatedMsg != OBJ_MSG_INVALID) { if(GOLMsgCallback(translatedMsg, pCurrentObj, pMsg)) if(pCurrentObj->MsgDefaultObj) pCurrentObj->MsgDefaultObj(translatedMsg, pCurrentObj, pMsg); } } } pCurrentObj = pCurrentObj->pNxtObj; }