APPW_JOB_SETBKCOLOR does not work for Button object

  • - AppWizard V1.52_6.44b

    I am trying to change the color of the Button object using user code.

    ```
    void ID_SCREEN_00__ID_BUTTON_00__WM_NOTIFICATION_CLICKED(APPW_ACTION_ITEM * pAction, WM_HWIN hScreen, WM_MESSAGE * pMsg, int * pResult) {
    GUI_USE_PARA(pAction);
    GUI_USE_PARA(hScreen);
    GUI_USE_PARA(pMsg);
    GUI_USE_PARA(pResult);


    //~~~(2025.01.23)
    APPW_PARA_ITEM aPara[6];
    aPara[0].v = 0xffaa0000; // RED
    APPW_DoJob(ID_SCREEN_00, ID_BUTTON_00, APPW_JOB_SETBKCOLOR, aPara);
    //APPW_DoJob(ID_SCREEN_00, ID_BUTTON_00, APPW_SET_PROP_BKCOLORS, aPara);
    }
    ```

    The above code does not take effect.
    What am I making mistake?

    Among several buttons, I would like to change the background color of only 1 button.

  • Hello,

    yes, seems that APPW_JOB_SETBKCOLOR is not working when called from the code for the button object. But it is working within APPWizard interactions. So just create a variable in APPWizard (for ex. ID_VAR_BKCOL), then create an interaction with SETBKCOLOR job at your button on changing the value of ID_VAR_BKCOL. Then in your code just do APPW_SetVarData(ID_VAR_BKCOL, YOUR_COLOR), here you go.

    Regards,

    Anthony

  • Dear Anthony

    Thank you very much. This worked.

    However, this way all the buttons must have variables for the bkcolor.
    I have to come up with some clever way to manage those variables.

    I hope APPW_JOB_SETBKCOLOR will work in the future update of the emWin.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!