Hi, i'm trying to create my own app since the basic example "Hello word" on stm32F429I discovery (give with the firmware pack for this card). I'm using guiBuilder to design a little window with just 2 buttons for the moment. I create the C file and include it to my project. The screen show the window with the 2 buttons. For the moment all works fine, but when i touch the button 1 for example (this card is equipped with a touch sreen), this one stay pressed ! i need to touch another area on the screen to unpressed the button (or another widget). Do you know how i can proceed to unpressed the button directly after i touch the screen (like a click with a mouse) ?
below the code i use,
FramewinDLG.c :
Display All
and main.c (GUI STATE) :
Display All
below the code i use,
FramewinDLG.c :
C Source Code
- static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
- { FRAMEWIN_CreateIndirect, "Framewin", ID_FRAMEWIN_0, 0, 0, 240, 320, 0, 0x64, 0 },
- { BUTTON_CreateIndirect, "Button", ID_BUTTON_0, 5, 250, 100, 40, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "Button", ID_BUTTON_1, 125, 250, 100, 40, 0, 0x0, 0 },
- // USER START (Optionally insert additional widgets)
- // USER END
- };
- /*********************************************************************
- *
- * Static code
- *
- **********************************************************************
- */
- // USER START (Optionally insert additional static code)
- // USER END
- /*********************************************************************
- *
- * _cbDialog
- */
- static void _cbDialog(WM_MESSAGE * pMsg) {
- WM_HWIN hItem;
- int NCode;
- int Id;
- // USER START (Optionally insert additional variables)
- // USER END
- switch (pMsg->MsgId) {
- case WM_INIT_DIALOG:
- //
- // Initialization of 'Framewin'
- //
- hItem = pMsg->hWin;
- FRAMEWIN_SetText(hItem, "Test");
- FRAMEWIN_SetTitleHeight(hItem, 20);
- FRAMEWIN_SetFont(hItem, GUI_FONT_20_1);
- //
- // Initialization of 'Button'
- //
- hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
- BUTTON_SetText(hItem, "Button 1");
- //
- // Initialization of 'Button'
- //
- hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
- BUTTON_SetText(hItem, "Button 2");
- // USER START (Optionally insert additional code for further widget initialization)
- // USER END
- break;
- case WM_NOTIFY_PARENT:
- Id = WM_GetId(pMsg->hWinSrc);
- NCode = pMsg->Data.v;
- switch(Id) {
- case ID_BUTTON_0: // Notifications sent by 'Button'
- switch(NCode) {
- case WM_NOTIFICATION_CLICKED:
- // USER START (Optionally insert code for reacting on notification message)
- // USER END
- break;
- case WM_NOTIFICATION_RELEASED:
- // USER START (Optionally insert code for reacting on notification message)
- // USER END
- break;
- // USER START (Optionally insert additional code for further notification handling)
- // USER END
- }
- break;
- case ID_BUTTON_1: // Notifications sent by 'Button'
- switch(NCode) {
- case WM_NOTIFICATION_CLICKED:
- // USER START (Optionally insert code for reacting on notification message)
- // USER END
- break;
- case WM_NOTIFICATION_RELEASED:
- // USER START (Optionally insert code for reacting on notification message)
- // USER END
- break;
- // USER START (Optionally insert additional code for further notification handling)
- // USER END
- }
- break;
- // USER START (Optionally insert additional code for further Ids)
- // USER END
- }
- break;
- // USER START (Optionally insert additional message handling)
- // USER END
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- /*********************************************************************
- *
- * Public code
- *
- **********************************************************************
- */
- /*********************************************************************
- *
- * CreateFramewin
- */
- WM_HWIN CreateFramewin(void);
- WM_HWIN CreateFramewin(void) {
- WM_HWIN hWin;
- hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
- return hWin;
- }
and main.c (GUI STATE) :
C Source Code
- void BSP_Pointer_Update(void)
- {
- GUI_PID_STATE TS_State;
- static TS_StateTypeDef prev_state;
- TS_StateTypeDef ts;
- uint16_t xDiff, yDiff;
- BSP_TS_GetState(&ts);
- TS_State.Pressed = ts.TouchDetected;
- xDiff = (prev_state.X > ts.X) ? (prev_state.X - ts.X) : (ts.X - prev_state.X);
- yDiff = (prev_state.Y > ts.Y) ? (prev_state.Y - ts.Y) : (ts.Y - prev_state.Y);
- if(ts.TouchDetected)
- {
- if((prev_state.TouchDetected != ts.TouchDetected )||
- (xDiff > 3 )||
- (yDiff > 3))
- {
- prev_state = ts;
- TS_State.Layer = 0;
- TS_State.x = ts.X;
- TS_State.y = ts.Y;
- GUI_TOUCH_StoreStateEx(&TS_State);
- }
- }
- }
The post was edited 2 times, last by modjo ().