Hi,
The goal is to create a button with Multi strings where the strings have different fonts from each other, So as suggested by emwin documentation I have created a custom callback function but I observe that the custom callback is overwriting all the previous set properties. The codes are as follows
the callback function
Display All
the result would be that
the entire OFF_WHITE background is replaced by white color except for the two strings. Is there any method where the button_<routines> can be used along with custom modifications.
Thanks
The goal is to create a button with Multi strings where the strings have different fonts from each other, So as suggested by emwin documentation I have created a custom callback function but I observe that the custom callback is overwriting all the previous set properties. The codes are as follows
Source Code
- hButton = WM_GetDialogItem(pMsg->hWin, ID_BUTTON1);
- WM_SetCallback(hButton , CallBack_Button);
- hButton = WM_GetDialogItem(pMsg->hWin, ID_BUTTON1);
- BUTTON_SetBkColor(hButton, BUTTON_CI_UNPRESSED, SKY_BLUE);
- BUTTON_SetBkColor(hButton, BUTTON_CI_PRESSED, HEADER_OFFWHITE);
- BUTTON_SetTextColor(hButton, BUTTON_CI_PRESSED, BASE_BLUE);
- BUTTON_SetTextColor(hButton, BUTTON_CI_UNPRESSED, BASE_BLUE);
the callback function
Source Code
- void CallBack_Button(WM_MESSAGE * pMsg) {
- GUI_RECT Rect;
- int Index;
- int TextAlign;
- switch (pMsg->MsgId) {
- case WM_PAINT:
- WM_GetClientRect(&Rect);
- if(BUTTON_IsPressed(pMsg->hWin)) {
- GUI_SetBkColor(HEADER_OFFWHITE);
- GUI_SetColor(BASE_BLUE);
- } else {
- GUI_SetBkColor(BASE_BLUE);
- GUI_SetColor(SKY_BLUE);
- }
- GUI_SetFont(&GUI_Fontsymbols_Regular_36);
- GUI_DispCharAt('&',Rect.x0 + 10,Rect.y0 + 10);
- GUI_SetFont(&GUI_Font_UI_Tab_Bold_22);
- GUI_DispStringAt("Stop",Rect.x0 + 40,Rect.y0 + 10);
- break;
- default:
- BUTTON_Callback(pMsg);
- break;
- }
- }
the entire OFF_WHITE background is replaced by white color except for the two strings. Is there any method where the button_<routines> can be used along with custom modifications.
Thanks
The post was edited 2 times, last by Suresh ().