Dropdown widget issues
Hello,
I'm using a super simple test program with the DROPDOWN Widget. I actually used the example code from Segger's WIDGET_Dropdown.c
I'm using the simulator on a WIN10 machine.
B) When I add the Buttons and a Callback() function to handle my Buttons the behavior highlighted above takes place: "Dropdown widget expands only at the first touch on the screen and never closes."
C) I figured out that the Dropdown widget actually closes but the Background is not redrawn so it "looks" as if the Dropdown widget is still expanded.
D) To prove this I added a Callback function to redraw the background :
WM_SetCallback(WM_HBKWIN, cbBackgroundWin);
/*******************************************************************
* *
Callback routine for background window
* ********************************************************************
*/
static void cbBackgroundWin(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
GUI_Clear();
break;
default:
WM_DefaultProc(pMsg);
}
}
This now works and the Dropdown opens/closes as expected but all the primitives (circles, rectangles, etc...), and text I have that were drawn on the screen are erased when this cbBackgroundWin() is called, which means I would have to draw all my primitives and text in the cbBackgroundWin() Callback. That is really not elegant coding. Is there another way?
Thanks for your help in advance
Electrons4me
Hello,
I'm using a super simple test program with the DROPDOWN Widget. I actually used the example code from Segger's WIDGET_Dropdown.c
I'm using the simulator on a WIN10 machine.
- When I only have the Dropdown widget in my program everything works perfectly.
- Now I added Buttons to the above program and the buttons works but the Dropdown widget expands only at the first touch on the screen. After the first click on the down arrow it never closes again. All the rest of the widgets (Buttons) present in the window still work.
- I isolated the issue to the following:
B) When I add the Buttons and a Callback() function to handle my Buttons the behavior highlighted above takes place: "Dropdown widget expands only at the first touch on the screen and never closes."
C) I figured out that the Dropdown widget actually closes but the Background is not redrawn so it "looks" as if the Dropdown widget is still expanded.
D) To prove this I added a Callback function to redraw the background :
WM_SetCallback(WM_HBKWIN, cbBackgroundWin);
/*******************************************************************
* *
Callback routine for background window
* ********************************************************************
*/
static void cbBackgroundWin(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
GUI_Clear();
break;
default:
WM_DefaultProc(pMsg);
}
}
This now works and the Dropdown opens/closes as expected but all the primitives (circles, rectangles, etc...), and text I have that were drawn on the screen are erased when this cbBackgroundWin() is called, which means I would have to draw all my primitives and text in the cbBackgroundWin() Callback. That is really not elegant coding. Is there another way?
Thanks for your help in advance
Electrons4me