|

楼主 |
发表于 2024-5-23 12:28:12
|
显示全部楼层
本帖最后由 hpxzw_foxmai 于 2024-5-24 09:38 编辑
版主,断断续续搞了一段时间,现在可以重现了
点击右边3个窗口,弹出一个大窗口,然后继续点击右边区域,会关闭大窗口
这个时候会闪烁
麻烦你看一下怎么处理,谢谢
公司有加密的,文件保存有乱码,就直接贴代码,可以在模拟器运行
触摸响应代码如下
{
WM_HWIN hWinMSG;
hWinMSG = GetChildByPos(TS_State.x, TS_State.y);
WM_SendMessageNoPara(WM_GetClientWindow(hWinMSG), WM_TOUCH);
}
---------------------------------------------------------------------------------------------------------------
#define LCD_REAL_XSIZE (1280)
#define LCD_REAL_YSIZE (800)
#define BTNW 150
#define BTNH (80)
#define BTNX1 100
#define BTNX2 (BTNX1 + BTNW + 10)
static const GUI_WIDGET_CREATE_INFO _aDialogCreateTest[] = {
{ WINDOW_CreateIndirect, "Caption", 0x1000, 0, 0, LCD_REAL_XSIZE * 2 /3 + 30, LCD_REAL_YSIZE, 0,0x0,0},
{ BUTTON_CreateIndirect, "Button1", 0x1001, BTNX1, 100, BTNW, BTNH, 0,0x0,0},
{ BUTTON_CreateIndirect, "Button2", 0x1002, BTNX2, 100, BTNW, BTNH, 0,0x0,0},
{ BUTTON_CreateIndirect, "Button3", 0x1003, BTNX1, 200, BTNW, BTNH, 0,0x0,0},
{ BUTTON_CreateIndirect, "Button4", 0x1004, BTNX2, 200, BTNW, BTNH, 0,0x0,0},
{ BUTTON_CreateIndirect, "Button5", 0x1005, BTNX1, 500, BTNW, BTNH, 0,0x0,0},
{ BUTTON_CreateIndirect, "Button6", 0x1006, BTNX2, 500, BTNW, BTNH, 0,0x0,0},
{ BUTTON_CreateIndirect, "Button7", 0x1007, BTNX1, 600, BTNW, BTNH, 0,0x0,0},
{ BUTTON_CreateIndirect, "Button8", 0x1008, BTNX2, 600, BTNW, BTNH, 0,0x0,0},
};
static WM_HWIN hDlg_Test = WM_HWIN_NULL;
static void _cbCallbackTest(WM_MESSAGE* pMsg)
{
switch(pMsg->MsgId)
{
case WM_DELETE:
{
hDlg_Test = WM_HWIN_NULL;
}
break;
case WM_PAINT:
{
GUI_RECT rect;
WM_GetClientRectEx(pMsg->hWin, &rect);
GUI_SetColor(COLOR_WHITE);
GUI_FillRectEx(&rect);
}
break;
default:WM_DefaultProc(pMsg);break;
}
}
WM_HWIN CreateTestpDialog(void)
{
hDlg_Test = GUI_CreateDialogBox(_aDialogCreateTest, GUI_COUNTOF(_aDialogCreateTest), &_cbCallbackTest, 0, 0, 0);
return hDlg_Test;
}
static void _cbBkWin1(WM_MESSAGE* pMsg)
{
switch(pMsg->MsgId)
{
case WM_PAINT:
{
GUI_RECT rect;
WM_GetClientRectEx(pMsg->hWin, &rect);
GUI_SetColor(COLOR_BLUE);
GUI_FillRectEx(&rect);
}
break;
default:WM_DefaultProc(pMsg);break;
}
}
static void _cbBkWin_child(WM_MESSAGE* pMsg)
{
switch(pMsg->MsgId)
{
case WM_PAINT:
{
GUI_RECT rect;
WM_GetClientRectEx(pMsg->hWin, &rect);
GUI_SetColor(COLOR_RED);
GUI_FillRectEx(&rect);
}
break;
default:WM_DefaultProc(pMsg);break;
}
}
static void _cbBkWin_child2(WM_MESSAGE* pMsg)
{
switch(pMsg->MsgId)
{
case WM_PAINT:
{
GUI_RECT rect;
WM_GetClientRectEx(pMsg->hWin, &rect);
GUI_SetColor(COLOR_MAGENTA);
GUI_FillRectEx(&rect);
}
break;
case WM_TOUCH:
case MSG_KEY_ENTER://case USER_MSG_START0:
{
if(WM_HWIN_NULL == hDlg_Test)
{
CreateTestpDialog();
}
else
{
GUI_EndDialog(hDlg_Test, 1);
}
}
break;
default:WM_DefaultProc(pMsg); break;
}
}
#define ARRAY_LEN (10)
WM_HWIN hClild, hClildArr[ARRAY_LEN] = {0};
GUI_RECT rectArr[ARRAY_LEN] = {0};
void SetInfoToArr(int index, int x, int y, int xsize, int ysize)
{
if(index >= ARRAY_LEN)
{
return;
}
rectArr[index].x0 = x;
rectArr[index].y0 = y;
rectArr[index].x1 = rectArr[index].x0 + xsize;
rectArr[index].y1 = rectArr[index].y0 + ysize;
}
WM_HWIN GetChildByPos(int x, int y)
{
for(int i = 0; i < ARRAY_LEN; i++)
{
if(WM_HWIN_NULL != hClildArr)
{
if(((x > rectArr.x0) && (rectArr.y0<y)) && ((rectArr.x1>x) && (rectArr.y1 > y)))
{
return hClildArr;
}
}
}
return WM_HWIN_NULL;
}
static void createFrame(void)
{
int hLeft = LCD_REAL_YSIZE / 6;
int wLeft = LCD_REAL_XSIZE * 2 /3;
int hRight = LCD_REAL_YSIZE / 3;
int wRight = LCD_REAL_XSIZE - wLeft;
WIDGET_SetDefaultEffect(&WIDGET_Effect_Simple);/* 控件使用简单样式 */
TEXT_SetDefaultTextColor(COLOR_GREEN);
//TEXT_SetDefaultFont(g_systemInfo.fontGUI.pDefText);
HEADER_SetDefaultSkinClassic();
SCROLLBAR_SetDefaultSkinClassic();
WINDOW_SetDefaultBkColor(COLOR_CYAN);
FRAMEWIN_SetDefaultSkinClassic(); /* 开启窗口经典模式 */
FRAMEWIN_SetDefaultClientColor(COLOR_CYAN);
LISTVIEW_SetDefaultGridColor(COLOR_CYAN);
hClildArr[0] = hClild = FRAMEWIN_CreateEx(0, hLeft * 0, wLeft - 1, hLeft - 1, WM_HBKWIN, WM_CF_SHOW, 0, 0, "", _cbBkWin_child);
FRAMEWIN_SetTitleVis(hClild, 0); FRAMEWIN_SetBorderSize(hClild, 0);SetInfoToArr(0, 0, hLeft * 0, wLeft - 1, hLeft - 1);
hClildArr[1] = hClild = FRAMEWIN_CreateEx(0, hLeft * 1, wLeft - 1, hLeft - 1, WM_HBKWIN, WM_CF_SHOW, 0, 0, "", _cbBkWin_child);
FRAMEWIN_SetTitleVis(hClild, 0); FRAMEWIN_SetBorderSize(hClild, 0);SetInfoToArr(1, 0, hLeft * 1, wLeft - 1, hLeft - 1);
hClildArr[2] = hClild = FRAMEWIN_CreateEx(0, hLeft * 2, wLeft - 1, hLeft - 1, WM_HBKWIN, WM_CF_SHOW, 0, 0, "", _cbBkWin_child);
FRAMEWIN_SetTitleVis(hClild, 0); FRAMEWIN_SetBorderSize(hClild, 0);SetInfoToArr(2, 0, hLeft * 2, wLeft - 1, hLeft - 1);
hClildArr[3] = hClild = FRAMEWIN_CreateEx(0, hLeft * 3, wLeft - 1, hLeft - 1, WM_HBKWIN, WM_CF_SHOW, 0, 0, "", _cbBkWin_child);
FRAMEWIN_SetTitleVis(hClild, 0); FRAMEWIN_SetBorderSize(hClild, 0);SetInfoToArr(3, 0, hLeft * 3, wLeft - 1, hLeft - 1);
hClildArr[4] = hClild = FRAMEWIN_CreateEx(0, hLeft * 4, wLeft - 1, hLeft - 1, WM_HBKWIN, WM_CF_SHOW, 0, 0, "", _cbBkWin_child);
FRAMEWIN_SetTitleVis(hClild, 0); FRAMEWIN_SetBorderSize(hClild, 0);SetInfoToArr(4, 0, hLeft * 4, wLeft - 1, hLeft - 1);
hClildArr[5] = hClild = FRAMEWIN_CreateEx(0, hLeft * 5, wLeft - 1, hLeft - 1, WM_HBKWIN, WM_CF_SHOW, 0, 0, "", _cbBkWin_child);
FRAMEWIN_SetTitleVis(hClild, 0); FRAMEWIN_SetBorderSize(hClild, 0);SetInfoToArr(5, 0, hLeft * 5, wLeft - 1, hLeft - 1);
hClildArr[6] = hClild = FRAMEWIN_CreateEx(wLeft, hRight * 0, wRight - 1, hRight - 1, WM_HBKWIN, WM_CF_SHOW, 0, 0, "", _cbBkWin_child2);
FRAMEWIN_SetTitleVis(hClild, 0); FRAMEWIN_SetBorderSize(hClild, 0);SetInfoToArr(6, wLeft, hRight * 0, wRight - 1, hRight - 1);
hClildArr[7] = hClild = FRAMEWIN_CreateEx(wLeft, hRight * 1, wRight - 1, hRight - 1, WM_HBKWIN, WM_CF_SHOW, 0, 0, "", _cbBkWin_child2);
FRAMEWIN_SetTitleVis(hClild, 0); FRAMEWIN_SetBorderSize(hClild, 0);SetInfoToArr(7, wLeft, hRight * 1, wRight - 1, hRight - 1);
hClildArr[8] = hClild = FRAMEWIN_CreateEx(wLeft, hRight * 2, wRight - 1, hRight - 1, WM_HBKWIN, WM_CF_SHOW, 0, 0, "", _cbBkWin_child2);
FRAMEWIN_SetTitleVis(hClild, 0); FRAMEWIN_SetBorderSize(hClild, 0);SetInfoToArr(8, wLeft, hRight * 2, wRight - 1, hRight - 1);
}
void apptask_gui(void *argument)
{
(void)argument;
GUI_Init();
GUI_EnableAlpha(0);
WM_SetCreateFlags(WM_CF_MEMDEV);
WM_EnableMemdev(WM_HBKWIN);
WM_SetDesktopColor(COLOR_BLACK);
WM_MULTIBUF_Enable(1);
createFrame();
WM_SetCallback(WM_HBKWIN, _cbBkWin1);
#ifdef WIN32
// createFreeRtosThread();
#endif
while(1)
{
/* 喂狗 */
//iwdg_feed();
GUI_Delay(10);
if(1)
{
static int touchCnt = 0;
touchCnt++;
if(touchCnt >= 3)
{
touchCnt = 0;
Touch_Exec();
}
}
}
} |
|