EMWIN框架窗口小工具加滚动条后,滚动条动了但是窗口没有动static const GUI_WIDGET_CREATE_INFO _aDialogSpinbox[] = {
{ FRAMEWIN_CreateIndirect, "channel", 0, 0, 0, 240, 320, 0, 0, 0 },
{ TEXT_CreateIndirect, "channel", GUI_ID_TEXT0, 5, 0, 40, 21, 0, 0, 0 },
{ SPINBOX_CreateIndirect, NULL, GUI_ID_SPINBOX0, 5, 15, 40, 21, 0, 0, 0 },
{ SPINBOX_CreateIndirect, NULL, GUI_ID_SPINBOX1, 5, 40, 40, 21, 0, 0, 0 },
{ TEXT_CreateIndirect, "name", GUI_ID_TEXT1, 50, 0, 40, 21, 0, 0, 0 },
{ EDIT_CreateIndirect, NULL, GUI_ID_EDIT0, 50, 15, 50, 21, 0, 0, 0 },
{ EDIT_CreateIndirect, NULL, GUI_ID_EDIT1, 50, 40, 50, 21, 0, 0, 0 },
{ TEXT_CreateIndirect, "SIGNAL", GUI_ID_TEXT2, 115, 0, 40, 21, 0, 0, 0 },
{ DROPDOWN_CreateIndirect, NULL, GUI_ID_DROPDOWN0, 115, 15, 40, 65, DROPDOWN_CF_AUTOSCROLLBAR},
{ DROPDOWN_CreateIndirect, NULL, GUI_ID_DROPDOWN1, 115, 40, 40, 65, DROPDOWN_CF_AUTOSCROLLBAR},
{ TEXT_CreateIndirect, "TYPE", GUI_ID_TEXT3, 165, 0, 40, 21, 0, 0, 0 },
{ DROPDOWN_CreateIndirect, NULL, GUI_ID_DROPDOWN2, 165, 15, 40, 65, DROPDOWN_CF_AUTOSCROLLBAR},
{ DROPDOWN_CreateIndirect, NULL, GUI_ID_DROPDOWN3, 165, 40, 40, 65, DROPDOWN_CF_AUTOSCROLLBAR},
{ TEXT_CreateIndirect, "signal", GUI_ID_TEXT4, 215, 0, 40, 21, 0, 0, 0 },
{ TEXT_CreateIndirect, "", GUI_ID_TEXT5, 265, 0, 40, 21, 0, 0, 0 },
//{ SCROLLBAR_CreateIndirect, NULL, GUI_ID_SCROLLBAR0, 240, 180, 70, 15, 0 },
};
static void _cbClient(WM_MESSAGE * pMsg) {
WM_HWIN hItem;
int Value;
int NCode;
int Id;
int i;
switch (pMsg->MsgId)
{
case WM_INIT_DIALOG:
FRAMEWIN_SetFont(pMsg->hWin, GUI_FONT_16B_ASCII);
FRAMEWIN_SetSkin(pMsg->hWin, FRAMEWIN_SKIN_FLEX);
SCROLLBAR_SetWidth(SCROLLBAR_CreateAttached(pMsg->hWin,SCROLLBAR_CF_VERTICAL),16);
//hScroll = SCROLLBAR_CreateAttached(pMsg->hWin, 0);
//SCROLLBAR_SetNumItems(hScroll, 48 *6);
//SCROLLBAR_SetPageSize(hScroll, 220);
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_TEXT0);
TEXT_SetTextAlign(hItem, GUI_TA_VCENTER | GUI_TA_RIGHT);
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_TEXT1);
TEXT_SetTextAlign(hItem, GUI_TA_VCENTER | GUI_TA_RIGHT);
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_TEXT2);
TEXT_SetTextAlign(hItem, GUI_TA_VCENTER | GUI_TA_RIGHT);
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_TEXT3);
TEXT_SetTextAlign(hItem, GUI_TA_VCENTER | GUI_TA_RIGHT);
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_TEXT4);
TEXT_SetTextAlign(hItem, GUI_TA_VCENTER | GUI_TA_RIGHT);
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_TEXT5);
TEXT_SetTextAlign(hItem, GUI_TA_VCENTER | GUI_TA_RIGHT);
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_SPINBOX0);
SPINBOX_SetSkin(hItem, SPINBOX_SKIN_FLEX);
hEdit = SPINBOX_GetEditHandle(hItem);
EDIT_SetDecMode(hEdit, 1, 1, 32, 0, 0);
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_SPINBOX1);
SPINBOX_SetSkin(hItem, SPINBOX_SKIN_FLEX);
hEdit = SPINBOX_GetEditHandle(hItem);
EDIT_SetDecMode(hEdit, 1, 1, 32, 0, 0);
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_EDIT0);
EDIT_SetText(hItem, "edit");
EDIT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER);
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_EDIT1);
EDIT_SetText(hItem, "edit");
EDIT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER);
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_DROPDOWN0);
DROPDOWN_SetAutoScroll(hItem,1);
DROPDOWN_AddString(hItem, "VOL");
DROPDOWN_AddString(hItem, "CUR");
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_DROPDOWN1);
DROPDOWN_SetAutoScroll(hItem,1);
DROPDOWN_AddString(hItem, "VOL");
DROPDOWN_AddString(hItem, "CUR");
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_DROPDOWN2);
DROPDOWN_SetAutoScroll(hItem,1);
/*
for (i = 0; i < 10; i++) {
char acBuffer[] = {"x"};
acBuffer[0] = '1' + i;
DROPDOWN_AddString(hItem, acBuffer);
}
*/
DROPDOWN_AddString(hItem, "FLOW");
DROPDOWN_AddString(hItem, "PRE");
DROPDOWN_AddString(hItem, "WAVE");
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_DROPDOWN3);
DROPDOWN_SetAutoScroll(hItem,1);
/*
for (i = 0; i < 10; i++) {
char acBuffer[] = {"x"};
acBuffer[0] = '1' + i;
DROPDOWN_AddString(hItem, acBuffer);
}
*/
DROPDOWN_AddString(hItem, "FLOW");
DROPDOWN_AddString(hItem, "PRE");
DROPDOWN_AddString(hItem, "WAVE");
break;
case WM_NOTIFY_PARENT:
NCode = pMsg->Data.v;
Id = WM_GetId(pMsg->hWinSrc);
switch(Id) {
case GUI_ID_SPINBOX0:
switch (NCode) {
case WM_NOTIFICATION_VALUE_CHANGED:
Value = SPINBOX_GetValue(pMsg->hWinSrc);
break;
}
case GUI_ID_SPINBOX1:
switch (NCode) {
case WM_NOTIFICATION_VALUE_CHANGED:
Value = SPINBOX_GetValue(pMsg->hWinSrc);
break;
}
break;
case GUI_ID_EDIT0:
switch (NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case GUI_ID_EDIT1:
switch (NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case GUI_ID_DROPDOWN0:
switch (NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case GUI_ID_DROPDOWN1:
switch (NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case GUI_ID_DROPDOWN2:
switch (NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
case GUI_ID_DROPDOWN3:
switch (NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
break;
case WM_NOTIFICATION_VALUE_CHANGED:
break;
}
break;
break;
}
break;
case WM_PAINT:
GUI_SetBkColor(0xAE9E8D);
GUI_Clear();
break;
default:
WM_DefaultProc(pMsg);
}
}
void MainTask(void) {
WM_HWIN hScroll;
GUI_RECT RectDlg;
GUI_RECT RectClient;
GUI_Init();
GUI_CreateDialogBox(_aDialogSpinbox, GUI_COUNTOF(_aDialogSpinbox), _cbClient,WM_HBKWIN, 30, 60);
while (1) {
GUI_Delay(100);
}
}
|