Hello, everyone.
There is a DIALOG with one BUTTON, that has ExtraBytes.
After storing data to the BUTTON-widget with WM_SetUserData the function WM_GetDialogItem for get BUTTON-widget returns 0.
Here is source-code:
Display All
There is a DIALOG with one BUTTON, that has ExtraBytes.
After storing data to the BUTTON-widget with WM_SetUserData the function WM_GetDialogItem for get BUTTON-widget returns 0.
Here is source-code:
C Source Code
- #define Data_t long long
- #define TEST_FRAMEWIN (GUI_ID_USER + 0x00)
- #define TEST_BUTTON (GUI_ID_USER + 0x01)
- static const GUI_WIDGET_CREATE_INFO _aDialogTest[] = {
- { FRAMEWIN_CreateIndirect, "Main window", TEST_FRAMEWIN, 0, 0, 200, 200, FRAMEWIN_CF_MOVEABLE, 0x0, sizeof(Data_t) },
- { BUTTON_CreateIndirect, "Button", TEST_BUTTON, 100, 10, 80, 20, 0, 0x0, sizeof(Data_t) },
- };
- static void _cbTest(WM_MESSAGE * pMsg) {
- int test;
- switch (pMsg->MsgId) {
- case WM_NOTIFY_PARENT:
- switch (pMsg->Data.v) {
- case WM_NOTIFICATION_RELEASED:
- switch (WM_GetId(pMsg->hWinSrc)) {
- case TEST_BUTTON:
- GUI_MessageBox("Button works", "BUTTON", 0); // check if button works
- break;
- }
- break;
- }
- break;
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- void MainTask() {
- GUI_Init();
- WM_SetBkWindowColor(GUI_WHITE);
- WM_HWIN mainWin = GUI_CreateDialogBox(_aDialogTest, GUI_COUNTOF(_aDialogTest), _cbTest, WM_HBKWIN, 0, 0);
- WM_HWIN button = WM_GetDialogItem(mainWin, TEST_BUTTON);
- int readBytes;
- Data_t value = 1234567890;
- readBytes = WM_SetUserData(button, &value, sizeof(Data_t));
- //Data_t readValue;
- //readBytes = WM_GetUserData(button, &readValue, sizeof(Data_t));
- button = WM_GetDialogItem(mainWin, TEST_BUTTON); // here button is 0
- while (1) {
- GUI_Delay(100);
- };
- }
Best regards,
Volodymyr.
Volodymyr.
The post was edited 1 time, last by volodymyr ().