I used an example from the emWIN and just replaced the screen source files.
I am using Keil MDK v5 pro with a GUISingleThread template.
On a Keil MCBSTM32F400 with STM32F407 and a 2.4" LCD resistive touch
If I touch the slider and move it and release it close to the top ( I have the slider positioned vertically), if I then place my finger all the way on the other side of the LCD sometimes the slider will react to the change in X position even though the Y is not even close. I just have the slider widgets dropped on the screen I do not have any code in their WM handlers yet.
I seem to notice it is only when the slider still has focus.
I thought WM would take care of this, should it not know the Y position of the new touch is not in the area of the widget?
Can you think of a reason the WM would not know the new area is not withing the x,y of the slider widget?
Here is a video of the behavior.
drive.google.com/open?id=0B5Oz…jBpVXZrUjU1dGM&authuser=0
I was thinking if I added code in the slider RELEASED method to remove focus might remedy this situation, do you think this would work?
This is my GUI thread
void GUIThread (void const *argument) {
GUI_Init(); /* Initialize the Graphics Component */
GUI_CURSOR_Show();
WM_SetCreateFlags(WM_CF_MEMDEV); // Use memory devices on all windows to avoid flicker
/* Add GUI setup code here */
//GUI_DispString("Hello World!");
Createiccp_main();
while (1) {
/* All GUI related activities might only be called from here */
#ifdef RTE_Graphics_Touchscreen /* Graphics Input Device Touchscreen enabled */
GUI_TOUCH_Exec(); /* Execute Touchscreen support */
#endif
GUI_Exec(); /* Execute all GUI jobs ... Return 0 if nothing was done. */
GUI_X_ExecIdle(); /* Nothing left to do for the moment ... Idle processing */
}
}
/*********************************************************************
*
* _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 'iccp_cv'
//
hItem = pMsg->hWin;
FRAMEWIN_SetText(hItem, "CV Adjust");
FRAMEWIN_SetTitleHeight(hItem, 20);
//
// Initialization of 'Home_Btn'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
BUTTON_SetText(hItem, "HOME");
BUTTON_SetFont(hItem, GUI_FONT_16B_ASCII);
//
// Initialization of 'Save'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
BUTTON_SetFont(hItem, GUI_FONT_16B_ASCII);
//
// Initialization of 'Amps_txt'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
TEXT_SetFont(hItem, GUI_FONT_D24X32);
TEXT_SetText(hItem, "49.5");
TEXT_SetTextColor(hItem, 0x000303E7);
//
// Initialization of 'Volts'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
TEXT_SetFont(hItem, GUI_FONT_20_1);
TEXT_SetTextColor(hItem, 0x00FF0000);
// 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 'Home_Btn'
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)
Createiccp_main();
// USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
case ID_BUTTON_1: // Notifications sent by 'Save'
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_SLIDER_0: // Notifications sent by 'Slider'
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;
case WM_NOTIFICATION_VALUE_CHANGED:
// 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;
}
}
I am using Keil MDK v5 pro with a GUISingleThread template.
On a Keil MCBSTM32F400 with STM32F407 and a 2.4" LCD resistive touch
If I touch the slider and move it and release it close to the top ( I have the slider positioned vertically), if I then place my finger all the way on the other side of the LCD sometimes the slider will react to the change in X position even though the Y is not even close. I just have the slider widgets dropped on the screen I do not have any code in their WM handlers yet.
I seem to notice it is only when the slider still has focus.
I thought WM would take care of this, should it not know the Y position of the new touch is not in the area of the widget?
Can you think of a reason the WM would not know the new area is not withing the x,y of the slider widget?
Here is a video of the behavior.
drive.google.com/open?id=0B5Oz…jBpVXZrUjU1dGM&authuser=0
I was thinking if I added code in the slider RELEASED method to remove focus might remedy this situation, do you think this would work?
This is my GUI thread
void GUIThread (void const *argument) {
GUI_Init(); /* Initialize the Graphics Component */
GUI_CURSOR_Show();
WM_SetCreateFlags(WM_CF_MEMDEV); // Use memory devices on all windows to avoid flicker
/* Add GUI setup code here */
//GUI_DispString("Hello World!");
Createiccp_main();
while (1) {
/* All GUI related activities might only be called from here */
#ifdef RTE_Graphics_Touchscreen /* Graphics Input Device Touchscreen enabled */
GUI_TOUCH_Exec(); /* Execute Touchscreen support */
#endif
GUI_Exec(); /* Execute all GUI jobs ... Return 0 if nothing was done. */
GUI_X_ExecIdle(); /* Nothing left to do for the moment ... Idle processing */
}
}
/*********************************************************************
*
* _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 'iccp_cv'
//
hItem = pMsg->hWin;
FRAMEWIN_SetText(hItem, "CV Adjust");
FRAMEWIN_SetTitleHeight(hItem, 20);
//
// Initialization of 'Home_Btn'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
BUTTON_SetText(hItem, "HOME");
BUTTON_SetFont(hItem, GUI_FONT_16B_ASCII);
//
// Initialization of 'Save'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
BUTTON_SetFont(hItem, GUI_FONT_16B_ASCII);
//
// Initialization of 'Amps_txt'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
TEXT_SetFont(hItem, GUI_FONT_D24X32);
TEXT_SetText(hItem, "49.5");
TEXT_SetTextColor(hItem, 0x000303E7);
//
// Initialization of 'Volts'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
TEXT_SetFont(hItem, GUI_FONT_20_1);
TEXT_SetTextColor(hItem, 0x00FF0000);
// 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 'Home_Btn'
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)
Createiccp_main();
// USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
case ID_BUTTON_1: // Notifications sent by 'Save'
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_SLIDER_0: // Notifications sent by 'Slider'
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;
case WM_NOTIFICATION_VALUE_CHANGED:
// 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;
}
}
The post was edited 1 time, last by likeitlowlevel ().