STM32f429+ FreeRTOS +EMWIN + 5寸屏 使用GUI_WIDGET_CREATE_INFO 资源表创建窗体, 1)主窗体使用: hWinMain = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog_main, WM_HBKWIN, 0, 0); 2)外部实体按键检测到对应的键值,发送自定义消息,WM_SendMessageNoPara(WM_GetClientWindow(hWinMain), MSG_DCV); 3)自定义消息处理--》_cbDialog_main 回调函数 -- case MSG_DCV: hDCV = GUI_CreateDialogBox(_aDialogCreate_DCV, GUI_COUNTOF(_aDialogCreate_DCV), &_cbCallback_DCV_new, WM_HBKWIN, 0, 0); 4)创建窗体显示控件 但是下个几个情况: ① 在 case WM_INIT_DIALOG中对EDIT 进行WM_SetFocus操作时,窗体不能正确显示;单独在MainTask函数调用是正常的; 假若在MainTask.c 文件使用hWinMain = GUI_CreateDialogBox(_aDialogCreate_DCV, GUI_COUNTOF(_aDialogCreate_DCV), &_cbCallback_DCV_new, 0, 0, 0); 直接创建,窗体可以正常显示,也能聚焦到EDIT0, ② 在 case WM_INIT_DIALOG中对BUTTON 进行BUTTON_SetFocusable(hutem,0)操作时,窗体不能正确显示; ③ case MSG_Set_Limit: 外部实体按键发送自定义消息,收到后对EDIT0设置焦点,Focus_index的值仿真也变成01,下面的EDIT_SetSel(hItem,0,-1); 本意是对EDIT0 的内容全选, 实际的测试结果不正常 单片机死机 ; ============================================================================= ① 的问题,仿真运行程序发现,程序运行卡死在 _cbCallback_DCV_new回调函数中的WM_INIT_DIALOG部分的 hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_2); 这个位置;如若将这部分代码注释掉,则卡死在后面的代码语句; ============================================================================= // 窗体资源表 static const GUI_WIDGET_CREATE_INFO _aDialogCreate_DCV[] = { { WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 800, 480, 0, 0x0, 0 }, { BUTTON_CreateIndirect, "Button", ID_BUTTON_0, 660, 20, 120, 40, 0, 0x0, 0 }, { BUTTON_CreateIndirect, "Button", ID_BUTTON_1, 660, 80, 120, 40, 0, 0x0, 0 }, { BUTTON_CreateIndirect, "Button", ID_BUTTON_2, 660, 140, 120, 40, 0, 0x0, 0 }, { BUTTON_CreateIndirect, "Button", ID_BUTTON_3, 660, 200, 120, 40, 0, 0x0, 0 }, { BUTTON_CreateIndirect, "Button", ID_BUTTON_4, 660, 260, 120, 40, 0, 0x0, 0 }, { BUTTON_CreateIndirect, "Button", ID_BUTTON_5, 660, 320, 120, 40, 0, 0x0, 0 }, { BUTTON_CreateIndirect, "Button", ID_BUTTON_6, 660, 380, 120, 40, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Text", ID_TEXT_0, 260, 10, 90, 32, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Text", ID_TEXT_1, 450, 107, 55, 38, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Text", ID_TEXT_2, 530, 88, 80, 32, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Text", ID_TEXT_3, 530, 120, 80, 32, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Text", ID_TEXT_4, 90, 200, 40, 32, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Text", ID_TEXT_8, 40, 91, 420, 64, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Text", ID_TEXT_9, 280, 200, 80, 32, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Text", ID_TEXT_11, 20, 340, 80, 32, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Text", ID_TEXT_12, 90, 340, 120, 32, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Text", ID_TEXT_13, 190, 340, 80, 32, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Text", ID_TEXT_14, 20, 385, 140, 32, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Text", ID_TEXT_15, 130, 385, 120, 32, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Text", ID_TEXT_16, 250, 385, 120, 32, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Text", ID_TEXT_17, 360, 384, 120, 32, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Text", ID_TEXT_21, 470, 340, 121, 32, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Text", ID_TEXT_23, 470, 385, 90, 32, 0, 0x0, 0 }, { TEXT_CreateIndirect, "Text", ID_TEXT_24, 571, 385, 80, 32, 0, 0x0, 0 }, { EDIT_CreateIndirect, "Edit", ID_EDIT_0, 90, 335, 100, 37, 0, 0x0, 0 }, { EDIT_CreateIndirect, "Edit", ID_EDIT_1, 580, 335, 60, 37, 0, 0x0, 0 }, { EDIT_CreateIndirect, "Edit", ID_EDIT_2, 128, 200, 150, 37, 0, 0x0, 0 }, { EDIT_CreateIndirect, "Edit", ID_EDIT_0, 90, 335, 100, 37, 0, 0x0, 0 }, { EDIT_CreateIndirect, "Edit", ID_EDIT_1, 580, 335, 60, 37, 0, 0x0, 0 }, { EDIT_CreateIndirect, "Edit", ID_EDIT_2, 128, 200, 150, 37, 0, 0x0, 0 }, }; // 回调函数 static void _cbCallback_DCV_new(WM_MESSAGE * pMsg) { int NCode, Id; WM_HWIN hWin = pMsg->hWin; WM_HWIN hItem; unsigned char Focus_index; switch (pMsg->MsgId) { case WM_PAINT : //GUI_SetBkColor(0xff87CEEB); GUI_SetBkColor(0xCCE8CF); GUI_Clear(); GUI_SetPenSize(4); GUI_SetColor(0x993333); GUI_DrawLine(10,330,645,330); GUI_DrawLine(10,330,10,430); GUI_DrawLine(645,330,645,430); GUI_DrawLine(10,430,645,430); GUI_DrawLine(10,375,645,375); GUI_DrawLine(240,330,240,430); GUI_DrawLine(460,330,460,430); break; case WM_INIT_DIALOG: hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0); BUTTON_SetFont(hItem,GUI_FONT_32B_1); BUTTON_SetText(hItem,""); //WM_DisableWindow(hItem); //BUTTON_SetFocusable(hItem,0); //WIDGET_SetFocusable(hItem,0); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1); BUTTON_SetFont(hItem,GUI_FONT_32B_1); BUTTON_SetText(hItem,"+ -"); //BUTTON_SetFocusable(hItem,0); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_2); BUTTON_SetFont(hItem,GUI_FONT_32B_1); BUTTON_SetText(hItem,"Limit"); //BUTTON_SetFocusable(hItem,0); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_3); BUTTON_SetFont(hItem,GUI_FONT_32B_1); BUTTON_SetText(hItem,"Voltage"); //BUTTON_SetFocusable(hItem,0); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_4); BUTTON_SetFont(hItem,GUI_FONT_32B_1); BUTTON_SetText(hItem,"Gear"); //BUTTON_SetFocusable(hItem,0); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_5); BUTTON_SetFont(hItem,GUI_FONT_32B_1); BUTTON_SetText(hItem,""); //BUTTON_SetFocusable(hItem,0); //WM_DisableWindow(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_6); BUTTON_SetFont(hItem,GUI_FONT_32B_1); BUTTON_SetText(hItem,"Reback"); //BUTTON_SetFocusable(hItem,0); //WM_DisableWindow(hItem); //WIDGET_SetFocusable(hItem,0); #if 0 hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0); WM_DisableWindow(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1); WM_DisableWindow(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_2); WM_DisableWindow(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_3); WM_DisableWindow(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_4); WM_DisableWindow(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_5); WM_DisableWindow(hItem); //hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_6); //WM_DisableWindow(hItem); #endif hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0); EDIT_SetFont(hItem, GUI_FONT_32B_1); EDIT_SetTextColor(hItem, EDIT_CI_ENABLED,GUI_RED); EDIT_SetText(hItem,"100.00"); WIDGET_SetFocusable(hItem,1); // 程序运行此条语句,窗体不能正常显示 //WM_SetFocus(hItem); //EDIT_EnableBlink(hItem,1000,1); //EDIT_SetSel(hItem,0,-1); hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_1); EDIT_SetText(hItem,"5"); EDIT_SetTextColor(hItem, EDIT_CI_ENABLED,GUI_MAGENTA); EDIT_SetFont(hItem, GUI_FONT_32_1); WIDGET_SetFocusable(hItem,1); EDIT_SetpfAddKeyEx(hItem, _cbEditAddKey); //WM_DisableWindow(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_2); EDIT_SetText(hItem,"100.00"); EDIT_SetTextColor(hItem, EDIT_CI_ENABLED,GUI_BLUE); EDIT_SetFont(hItem, GUI_FONT_32_1); WIDGET_SetFocusable(hItem,1); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0); TEXT_SetFont(hItem,GUI_FONT_32B_1); TEXT_SetTextColor(hItem,GUI_MAKE_COLOR(0x00800000)); TEXT_SetText(hItem,"DC-V"); WIDGET_SetFocusable(hItem,0); WM_DisableWindow(hItem); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1); TEXT_SetFont(hItem,GUI_FONT_32B_1); //TEXT_SetTextColor(hItem,GUI_MAKE_COLOR(0x00800000)); TEXT_SetText(hItem,"V"); WIDGET_SetFocusable(hItem,0); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2); TEXT_SetFont(hItem,GUI_FONT_32B_1); TEXT_SetTextColor(hItem,GUI_MAKE_COLOR(0x000000FF)); TEXT_SetText(hItem,"OFF"); WIDGET_SetFocusable(hItem,0); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_3); TEXT_SetFont(hItem,GUI_FONT_32B_1); TEXT_SetTextColor(hItem,GUI_MAKE_COLOR(0x00800000)); TEXT_SetText(hItem,"Hand"); WIDGET_SetFocusable(hItem,0); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_4); TEXT_SetFont(hItem,GUI_FONT_32B_1); //TEXT_SetTextColor(hItem,GUI_MAKE_COLOR(0x00800000)); TEXT_SetText(hItem,"V_"); WIDGET_SetFocusable(hItem,0); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_8); TEXT_SetFont(hItem,GUI_FONT_D64); TEXT_SetTextColor(hItem,GUI_MAKE_COLOR(0x00800000)); TEXT_SetText(hItem,"0.000000"); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_9); TEXT_SetFont(hItem,GUI_FONT_32B_1); //TEXT_SetTextColor(hItem,GUI_MAKE_COLOR(0x00800000)); TEXT_SetText(hItem,"V"); WIDGET_SetFocusable(hItem,0); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_11); TEXT_SetFont(hItem,GUI_FONT_32B_1); //TEXT_SetTextColor(hItem,GUI_MAKE_COLOR(0x00800000)); TEXT_SetText(hItem,"Limit"); WIDGET_SetFocusable(hItem,0); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_13); TEXT_SetFont(hItem,GUI_FONT_32B_1); //TEXT_SetTextColor(hItem,GUI_MAKE_COLOR(0x00800000)); TEXT_SetText(hItem,"V"); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_14); TEXT_SetFont(hItem,GUI_FONT_32B_1); //TEXT_SetTextColor(hItem,GUI_MAKE_COLOR(0x00800000)); TEXT_SetText(hItem,"R_Error"); WIDGET_SetFocusable(hItem,0); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_15); TEXT_SetFont(hItem,GUI_FONT_32B_1); //TEXT_SetTextColor(hItem,GUI_MAKE_COLOR(0x00800000)); TEXT_SetTextColor(hItem,GUI_BLUE); TEXT_SetText(hItem,"0.000%"); WIDGET_SetFocusable(hItem,0); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_16); TEXT_SetFont(hItem,GUI_FONT_32B_1); //TEXT_SetTextColor(hItem,GUI_MAKE_COLOR(0x00800000)); TEXT_SetText(hItem,"A_Error"); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_17); TEXT_SetFont(hItem,GUI_FONT_32B_1); //TEXT_SetTextColor(hItem,GUI_MAKE_COLOR(0x00800000)); TEXT_SetTextColor(hItem,GUI_BLUE); TEXT_SetText(hItem,"0.000%"); WIDGET_SetFocusable(hItem,0); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_21); TEXT_SetFont(hItem,GUI_FONT_32B_1); //TEXT_SetTextColor(hItem,GUI_MAKE_COLOR(0x00800000)); TEXT_SetText(hItem,"Division"); WIDGET_SetFocusable(hItem,0); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_23); TEXT_SetFont(hItem,GUI_FONT_32B_1); //TEXT_SetTextColor(hItem,GUI_MAKE_COLOR(0x00800000)); TEXT_SetText(hItem,"Status"); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_24); TEXT_SetFont(hItem,GUI_FONT_32B_1); //TEXT_SetTextColor(hItem,GUI_MAKE_COLOR(0x00800000)); TEXT_SetText(hItem,"OK"); WIDGET_SetFocusable(hItem,0); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch (Id) { } break; case WM_TIMER: break; case WM_KEY: switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key) { case GUI_KEY_TAB: break; case GUI_KEY_LEFT://GUI_KEY_LEFT break; case GUI_KEY_RIGHT://GUI_KEY_LEFT break; case GUI_KEY_ENTER: break; } break; case MSG_Set_Limit: hItem = WM_GetDialogItem(pMsg->hWin,ID_EDIT_0); WM_SetFocus(hItem); Focus_index = WM_HasFocus(WM_GetDialogItem(pMsg->hWin,ID_EDIT_0)); EDIT_SetSel(hItem,0,-1); break; default: WM_DefaultProc(pMsg); break; } } |
STM32H7ZGT6使用SPI+DMA方式驱动屏幕时候,使用阻塞式发送不会花屏幕,但是使用DMA方式会花屏。
怎么监听触摸动作松开?
H750 + TouchGFX分散加载KEIL5报错 Error: L6216E
STM32H7S78-DK板卡用CubeMX生成代码后编译不通过需要如何操作?
stm32g431rbt怎么显示汉字
CubeIDE报错
TouchGFX
touchgfx,H743搭配1280X800分辨率屏幕,能否流程运行?
我用TouchGFX生成的代码在keil中编译报错,我该如何解决?
touchGFX初始化卡住