/*******************************************************************************
 * FUNCTION: usMsgNumericKeypadPage
 *
 * PARAMETERS:
 * ~ objMsg     - Translated message for the object.
 * ~ pObj       - Pointer to the object.
 * ~ pMsg       - Pointer to the non-translated, raw GOL message.
 *
 * RETURN:
 * ~ If the function returns non-zero, the message will be processed by default.
 *
 * DESCRIPTIONS:
 * Handle the touchscreen event of the Set ID page.
 *
 *******************************************************************************/
WORD usMsgNumericKeypadPage(WORD objMsg, OBJ_HEADER *pObj, GOL_MSG *pMsg)
{
    unsigned short usObjectId = GetObjID(pObj);
    EDITBOX *pxEditbox1 = (EDITBOX*)GOLFindObject(GID_KEYPAD_EB_VALUE1);
    EDITBOX *pxEditbox2 = (EDITBOX*)GOLFindObject(GID_KEYPAD_EB_VALUE2);
    
    // Make sure button is released.
    if (objMsg == BTN_MSG_RELEASED) {
        // Clear message on editbox 1.
        vEditBoxUpdateText(pxEditbox1, "");

        // If key 0 - 9 is pressed...
        if ((usObjectId >= GID_KEYPAD_0) && (usObjectId <= GID_KEYPAD_9)) {
            // Add the pressed key to editbox 2.
            if (pxEditbox2 != NULL) {
                EbAddChar(pxEditbox2, '0' + (usObjectId - GID_KEYPAD_0));
                SetState(pxEditbox2, EB_DRAW);
            }
        }

        // DEL button.
        else if (usObjectId == GID_KEYPAD_DEL) {
            // Remove 1 character from editbox 2.
            if (pxEditbox2 != NULL) {
                EbDeleteChar(pxEditbox2);
                SetState(pxEditbox2, EB_DRAW);
            }
        }

    }
    
    
    return 1;
}
예제 #2
0
/*****************************************************************************
 * WORD MsgSecurityScreen(WORD objMsg, OBJ_HEADER *pObj, GOL_MSG *pMsg)
 *****************************************************************************/
WORD MsgSecurityScreen(WORD objMsg, OBJ_HEADER *pObj, GOL_MSG *pMsg)
{
    EDITBOX     *pEb;
    SHORT       id;
    XCHAR       temp;
    static char status = 0; // status to check if calling, holding or not
    id = GetObjID(pObj);

    MsgPanelScreen(objMsg, pObj);  //get messages from the panel also

    // If number key is pressed
    if(objMsg == BTN_MSG_PRESSED)
    {
        if(id >= SERCURITY_SCREEN_ID_KEYPAD_0_BUT)
        {
            if(id <= SERCURITY_SCREEN_ID_KEYPAD_9_BUT)
            {
                if(!status)
                {
                    pEb = (EDITBOX *)GOLFindObject(SERCURITY_SCREEN_ID_CODE_EDIT_BOX);
                    EbAddChar(pEb, '*');
                    SetState(pEb, EB_DRAW);
                }

                return (1);
            }
        }
    }

    switch(id)
    {

    case SERCURITY_SCREEN_ID_CLEAR_BUT:
    case SERCURITY_SCREEN_ID_ENTER_BUT:
        if(!status)
        {
            if(objMsg == BTN_MSG_PRESSED)
            {
                pEb = (EDITBOX *)GOLFindObject(SERCURITY_SCREEN_ID_CODE_EDIT_BOX);
                temp = 0x0000;
                EbSetText(pEb, &temp);
                SetState(pEb, EB_DRAW);
                status = 0;
            }
        }

        return (1);

    default:
        return (0);                         // process by default
    }
}