本人菜鸟一枚,,这段时间在编写一个UCGUI界面,是一个对话框程序(Dialog),需要创建一个Left按钮,其ID:GUI_KEY_LEFT,但是在资源表里创建这个按钮时,却不能自己设定其在对话框界面的位置,代码如下:/*****************************资源表*****************************************/
sta
tic const GUI_WIDGET_CREATE_INFO aDialogCreate[] = {
{ FRAMEWIN_CreateIndirect, "Dialog", 0, 10, 10, 162, 214, FRAMEWIN_CF_MOVEABLE},
{ BUTTON_CreateIndirect, "Up", GUI_KEY_UP, 56, 100, 40, 20 },
{ BUTTON_CreateIndirect, "Down", GUI_KEY_DOWN, 56, 150, 40, 20 },
// { BUTTON_CreateIndirect, "Left", GUI_KEY_LEFT 11, 125, 40, 20 },
// { BUTTON_CreateIndirect, "Right", GUI_KEY_RIGHT 101, 125, 40, 20 },
// { BUTTON_CreateIndirect, "Tab", GUI_KEY_TAB 56, 125, 40, 20 },
// { BUTTON_CreateIndirect, "Left", GUI_KEY_LEFT },
// { BUTTON_CreateIndirect, "Right", GUI_KEY_RIGHT },
// { BUTTON_CreateIndirect, "Tab", GUI_KEY_TAB },
{ EDIT_CreateIndirect, "", GUI_ID_EDIT0, 27, 5, 100, 20, EDIT_CF_RIGHT, 4 },
{ EDIT_CreateIndirect, "", GUI_ID_EDIT1, 27, 30, 100, 20, EDIT_CF_RIGHT, 4 },
{ EDIT_CreateIndirect, "", GUI_ID_EDIT2, 27, 55, 100, 20, EDIT_CF_RIGHT, 4 },
};
如果是按照这个代码来编译的话是没有报错的:
// { BUTTON_CreateIndirect, "Left", GUI_KEY_LEFT },
// { BUTTON_CreateIndirect, "Right", GUI_KEY_RIGHT },
// { BUTTON_CreateIndirect, "Tab", GUI_KEY_TAB },
编译结果如下:
Build target 'uCOSDemo'
compiling GUIDEMO_Direction_Key.c...
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c(116): warning: #550-D: variable "hWin" was set but never used
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c: WM_HWIN hWin;
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c: ^
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c(160): warning: #1-D: last line of file ends without a newline
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c: #endif /* GUI_SUPPORT_MEMDEV */
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c: ^
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c: SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c: 2 warnings, 0 errors
linking...
Program Size: Code=64218 RO-data=12074 RW-data=488 ZI-data=15800
FromELF: creating hex file...
".ObjuCOSDemo.axf" - 0 Error(s), 2 Warning(s).
但是实现后的结果是,只有最后一个TAB键是能够显示出来的,并且是显示在对话框的正中间:
图片在下面的附件里,
但是如果按照有自己设定的位置的代码来的话:
// { BUTTON_CreateIndirect, "Left", GUI_KEY_LEFT 11, 125, 40, 20 },
// { BUTTON_CreateIndirect, "Right", GUI_KEY_RIGHT 101, 125, 40, 20 },
// { BUTTON_CreateIndirect, "Tab", GUI_KEY_TAB 56, 125, 40, 20 },
编译报错:
Build target 'uCOSDemo'
compiling GUIDEMO_Direction_Key.c...
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c(29): error: #67: expected a "}"
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c: { BUTTON_CreateIndirect, "Left", GUI_KEY_LEFT 11, 125, 40, 20 },
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c: ^
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c(30): error: #67: expected a "}"
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c: { BUTTON_CreateIndirect, "Right", GUI_KEY_RIGHT 101, 125, 40, 20 },
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c: ^
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c(31): error: #67: expected a "}"
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c: { BUTTON_CreateIndirect, "Tab", GUI_KEY_TAB 56, 125, 40, 20 },
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c: ^
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c(116): warning: #550-D: variable "hWin" was set but never used
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c: WM_HWIN hWin;
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c: ^
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c(160): warning: #1-D: last line of file ends without a newline
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c: #endif /* GUI_SUPPORT_MEMDEV */
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c: ^
SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c: SourceuCGUIuCGUIDemoGUIDEMO_Direction_Key.c: 2 warnings, 3 errors
Target not created
我创建对话框的方式是阻塞式,,,,
hWin = GUI_ExecDialogBox(aDialogCreate, GUI_COUNTOF(aDialogCreate), _cbCallback, 0, 0, 0);
现在我想知道怎么才能自己设定LEFT方向键的位置,把它设置在自己需要的位置上,,求大神指教,,,感激不尽,,十万火急呐,,,,
-
手机像素差,,不太清楚
一周热门 更多>