/********************************************************************* * * _cbDialog */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int Id, NCode; // USER START (Optionally insert additional variables) // USER END switch (pMsg->MsgId) { case WM_INIT_DIALOG: // // Initialization of 'Demo' // hItem = pMsg->hWin; FRAMEWIN_SetText(hItem, "GUIBuilder Demo"); FRAMEWIN_SetFont(hItem, GUI_FONT_24B_ASCII); FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); FRAMEWIN_SetTextColor(hItem, 0x00FF8000); SCROLLBAR_CreateAttached(hItem, 0); SCROLLBAR_CreateAttached(hItem, SCROLLBAR_CF_VERTICAL); // // Initialization of 'Text' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0); TEXT_SetText(hItem, "This is a text!"); TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); TEXT_SetTextColor(hItem, 0x00000000); TEXT_SetFont(hItem, GUI_FONT_16B_ASCII); // 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 'Button' 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; // 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; } }
/********************************************************************* * * _FRAMEWIN_DrawSkinFlex */ static int _FRAMEWIN_DrawSkinFlex(const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo) { switch (pDrawItemInfo->Cmd) { case WIDGET_ITEM_CREATE: FRAMEWIN_SetTextAlign(pDrawItemInfo->hWin, GUI_TA_HCENTER | GUI_TA_VCENTER); FRAMEWIN_SetTextColor(pDrawItemInfo->hWin, GUI_BLACK); break; default: return FRAMEWIN_DrawSkinFlex(pDrawItemInfo); } return 0; }
static void OpenFileProcess(int sel_num,char* record_file) { result = f_open (&listfile, FILE_LIST_PATH, FA_READ|FA_OPEN_EXISTING); //打开索引文件 if(result != FR_OK) return ; result = f_lseek (&listfile, sel_num*BROWSER_FILE_NAME_LEN); if(result != FR_OK) return ; result = f_read (&listfile, curentopenfile, BROWSER_FILE_NAME_LEN, &bw); if(result != FR_OK) return ; //printf("\nfileItem=:%s",openfile); f_close (&listfile); if(strstr(curentopenfile,".gcode")||strstr(curentopenfile,".GCODE") ||strstr(curentopenfile,".g")||strstr(curentopenfile,".G")) //判断是否是gcode文件,可以执行打印指令 { //对话框显示是否打印该文件 _ChooseFrame = CreatePrintFileWaring(); WM_MakeModal(_ChooseFrame); } #if 0 else if(strstr(openfile,".txt")||strstr(openfile,".TXT") ||strstr(openfile,".c")||strstr(openfile,".c") ||strstr(openfile,".cpp")||strstr(openfile,".CPP") ||strstr(openfile,".h")||strstr(openfile,".h"))//判断是否可以使用txt格式打开 { //printf("\ntxt file"); WM_HideWindow(hDialog); hOpenfile=FRAMEWIN_CreateEx(0,0,320,240,WM_HBKWIN,WM_CF_SHOW,0,0,0,_cbOpenfile); FRAMEWIN_SetTextColor(hOpenfile,GUI_DARKGRAY); FRAMEWIN_SetTitleHeight(hOpenfile, 20); FRAMEWIN_SetText(hOpenfile,framename); FRAMEWIN_SetTextAlign(hOpenfile, GUI_TA_LEFT | GUI_TA_VCENTER); FRAMEWIN_AddCloseButton(hOpenfile,FRAMEWIN_BUTTON_RIGHT,0); hWin=MULTIEDIT_CreateEx(5,22,295,230,hOpenfile, WM_CF_SHOW,MULTIEDIT_CF_AUTOSCROLLBAR_V|MULTIEDIT_CF_READONLY,0,0,0); MULTIEDIT_SetBkColor(hWin,MULTIEDIT_CI_READONLY,GUI_WHITE); MULTIEDIT_SetWrapWord(hWin); MULTIEDIT_AddText(hWin,txtBuffer); } #endif else { GUI_MessageBox("Sorry,do not support open the file!","Sorry",GUI_MESSAGEBOX_CF_MODAL); } }
/***************************** Initializacija paneli nalashtuvan resursu *****************************/ void resurs_panel_show(void) { if (Resurs_FrameWin == WM_UNATTACHED) { //Stvorjujemo FrameWin Resurs_FrameWin = FRAMEWIN_CreateEx(X0, Y0, X_SIZE, Y_SIZE, 0, WM_CF_HIDE, 0, ID_RESURS_FRAMEWIN, Resurs_panel_title.ptitle[sel_language], _cbEmpty); FRAMEWIN_SetFont(Resurs_FrameWin, &GUI_FontArialBold14_8_Unicode); FRAMEWIN_SetTextAlign(Resurs_FrameWin, GUI_TA_HCENTER); FRAMEWIN_SetBarColor(Resurs_FrameWin, 1, GUI_GREEN); FRAMEWIN_SetBarColor(Resurs_FrameWin, 0, GUI_LIGHTGRAY); FRAMEWIN_SetTextColor(Resurs_FrameWin, GUI_BLUE); #define COL_1_X 5 #define ROW_1_Y 10 #define HIGHT_Y 10 #define SHIFT_Y (ROW_1_Y + HIGHT_Y) #define WIDTH_X_T 165 #define WIDTH_X_V 80 #define SHIFT_X1 (WIDTH_X_T + 10) #define SHIFT_X2 (SHIFT_X1 + WIDTH_X_V + 10) for (unsigned int i = 0; i < MAX_NUMBER_ITEMS_RESURS; i++) { Resurs_t[i] = TEXT_CreateEx(COL_1_X, ROW_1_Y + i*SHIFT_Y, WIDTH_X_T, HIGHT_Y, WM_GetClientWindow(Resurs_FrameWin), WM_CF_SHOW, TEXT_CF_LEFT | TEXT_CF_VCENTER, ID_RESURS_1_TITLE + i, Resurs_title[i].ptitle[sel_language]); TEXT_SetFont(Resurs_t[i], &GUI_FontArialStandard14_8_Unicode); Resurs_v[i] = TEXT_CreateEx(COL_1_X + SHIFT_X1, ROW_1_Y + i*SHIFT_Y, WIDTH_X_V, HIGHT_Y, WM_GetClientWindow(Resurs_FrameWin), WM_CF_SHOW, TEXT_CF_LEFT | TEXT_CF_VCENTER, ID_RESURS_1_VALUE + i, ""); TEXT_SetFont(Resurs_v[i], &GUI_FontArialStandard14_8_Unicode); } #undef COL_1_X #undef ROW_1_Y #undef HIGHT_Y #undef SHIFT_Y #undef WIDTH_X_T #undef WIDTH_X_V #undef SHIFT_X1 #undef SHIFT_X2 } WM_BringToTop(Resurs_FrameWin); WM_ShowWindow(Resurs_FrameWin); }
/********************************************************************* * * _cbDialog */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int NCode; int Id; // USER START (Optionally insert additional variables) // USER END GUI_DrawBitmap(&bmlogo,40,10); #if(Gradient_Rectangle) { GUI_DrawGradientRoundedH(220,120,580,380,20,REC_color1,REC_color2); } #endif #if(RoundedFrame) GUI_SetColor(GUI_GREEN); GUI_DrawRoundedFrame(218,118,582,382,20,3); #endif #if(FillRoundedRect) GUI_SetColor(RoundedRect); GUI_FillRoundedRect(220,120,580,380,20); #endif switch (pMsg->MsgId) { case WM_INIT_DIALOG: // // Initialization of 'inuse' // hItem = pMsg->hWin; FRAMEWIN_SetTitleVis(hItem, 0); FRAMEWIN_SetClientColor( hItem, framewin_backcolor); FRAMEWIN_SetFont(hItem, GUI_FONT_8_1); FRAMEWIN_SetText(hItem, "Framewin"); FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); FRAMEWIN_SetTextColor(hItem, 0x00000000); hItem = pMsg->hWin; FRAMEWIN_SetTitleVis(hItem, 0); hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1); BUTTON_SetFont(hItem, &GUI_Fonthz_song30); BUTTON_SetText(hItem, "返回 "); #if(Button_3Dskin) BUTTON_SetSkin(hItem,BUTTON_SKIN_FLEX); #endif #if(!Button_3Dskin) BUTTON_SetBkColor( hItem,BUTTON_CI_UNPRESSED,Button_unpress_color); BUTTON_SetBkColor( hItem,BUTTON_CI_PRESSED,Button_press_color); #endif // // Initialization of 'Button' // hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0); BUTTON_SetFont(hItem, &GUI_Fonthz_song30); BUTTON_SetText(hItem, "停止充电 "); #if(Button_3Dskin) BUTTON_SetSkin(hItem,BUTTON_SKIN_FLEX); #endif #if(!Button_3Dskin) BUTTON_SetBkColor( hItem,BUTTON_CI_UNPRESSED,Button_unpress_color); BUTTON_SetBkColor( hItem,BUTTON_CI_PRESSED,Button_press_color); #endif // // Initialization of 'Button' // // // Initialization of 'Edit' // hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0); EDIT_EnableBlink( hItem,1 ,0); EDIT_SetDecMode(hItem,0,0,99,0,0); EDIT_SetFont(hItem, GUI_FONT_32_ASCII); EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); // // Initialization of 'Edit' // hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_1); EDIT_EnableBlink( hItem,1 ,0); EDIT_SetDecMode(hItem,0,0,99,0,0); EDIT_SetFont(hItem, GUI_FONT_32_ASCII); EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); EDIT_SetTextColor(hItem, EDIT_CI_ENABLED, 0x00000000); // // Initialization of 'Edit' // hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_2); EDIT_EnableBlink( hItem,1 ,0); EDIT_SetDecMode(hItem,0,0,99,0,0); EDIT_SetFont(hItem, GUI_FONT_32_ASCII); EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); EDIT_SetTextColor(hItem, EDIT_CI_ENABLED, 0x00000000); // // Initialization of 'Edit' // hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_3); EDIT_EnableBlink( hItem,1 ,0); EDIT_SetDecMode(hItem,0,0,9999,0,0); EDIT_SetFont(hItem, GUI_FONT_32_ASCII); EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); EDIT_SetTextColor(hItem, EDIT_CI_ENABLED, 0x00000000); // // Initialization of 'cddianliang' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0); TEXT_SetFont(hItem, &GUI_Fonthz_song24); TEXT_SetText(hItem, "使用电量 "); TEXT_SetTextAlign(hItem, GUI_TA_RIGHT); TEXT_SetTextColor(hItem, 0x00000000); // // Initialization of 'Text' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1); TEXT_SetFont(hItem, &GUI_Fonthz_song24); TEXT_SetText(hItem, "使用时间 "); TEXT_SetTextColor(hItem, 0x00000000); TEXT_SetTextAlign(hItem, GUI_TA_RIGHT); // // Initialization of 'Text' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2); TEXT_SetFont(hItem, &GUI_Fonthz_song24); TEXT_SetText(hItem, "消费金额 "); TEXT_SetTextAlign(hItem, GUI_TA_RIGHT); TEXT_SetTextColor(hItem, 0x00000000); // // Initialization of 'Text' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_3); TEXT_SetFont(hItem, &GUI_Fonthz_song24); TEXT_SetText(hItem, "账户余额 "); TEXT_SetTextAlign(hItem, GUI_TA_RIGHT); TEXT_SetTextColor(hItem, 0x00000000); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_4); TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_TOP); TEXT_SetText(hItem, "安徽绿建科技有限公司 "); TEXT_SetTextColor(hItem, 0x00000000); TEXT_SetFont(hItem, &GUI_FontSong_60); // // Initialization of 'Text' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_5); TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_TOP); TEXT_SetTextColor(hItem, 0x00000000); TEXT_SetText(hItem, "ANHUI GREEN BUILDING TECHNOLOGY CO.,LTD."); TEXT_SetFont(hItem, GUI_FONT_24_ASCII); // 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 'Button' 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 // op=ensure; // handle_button(); GUI_EndDialog( pMsg->hWin,1); Createensure(); break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_BUTTON_1: // Notifications sent by 'Button' 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 GUI_EndDialog( pMsg->hWin,1); Createwindow0(); break; // USER START (Optionally insert additional code for further notification handling) // USER END } break; case ID_EDIT_0: // Notifications sent by 'Edit' 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; case ID_EDIT_1: // Notifications sent by 'Edit' 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; case ID_EDIT_2: // Notifications sent by 'Edit' 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; case ID_EDIT_3: // Notifications sent by 'Edit' 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; } }
/********************************************************************* * * _cbDialog */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int NCode; int Id; int i; switch (pMsg->MsgId) { case WM_INIT_DIALOG: hItem = pMsg->hWin; FRAMEWIN_SetTextColor(hItem, 0x00000000); // hItem = WM_GetDialogItem(pMsg->hWin, ID_TIMESET_TEXT_0); // TEXT_SetFont(hItem, &GUI_Font32_ASCII); // TEXT_SetTextColor(hItem, GUI_WHITE); hItem = WM_GetDialogItem(pMsg->hWin, ID_TIMESET_BUTTON_TITLE); BUTTON_SetSkinClassic(hItem); WIDGET_SetEffect(hItem, &WIDGET_Effect_None); BUTTON_SetText(hItem, ""); BUTTON_Set_Bitmap_Ex(pMsg->hWin, ID_TIMESET_BUTTON_TITLE, &_bmWhiteTimeCHN, 0, 13); Button_Set_BkColor(pMsg->hWin, ID_TIMESET_BUTTON_TITLE, GUI_BLACK); for(i=ID_TIMESET_BUTTON_CONFIRM;i<=ID_TIMESET_BUTTON_RESERVE5;i++){ hItem = WM_GetDialogItem(pMsg->hWin, i); Button_Init(hItem); if(i%2){ BUTTON_SetBkColor(hItem, BUTTON_CI_UNPRESSED, GUI_LIGHTGRAY); }else{ } } BUTTON_DispConfirmCHNStr(pMsg->hWin, ID_TIMESET_BUTTON_CONFIRM, 18, 43); BUTTON_DispCheckCHNStr(pMsg->hWin, ID_TIMESET_BUTTON_CHECK, 18, 43); BUTTON_DispResetCHNStr(pMsg->hWin, ID_TIMESET_BUTTON_RESET, 18, 43); BUTTON_DispCancelCHNStr(pMsg->hWin, ID_TIMESET_BUTTON_CANCEL, 18, 43); BUTTON_DispSerialNumCHNStr(pMsg->hWin, ID_TIMESET_BUTTON_SNSET, 14, 18); BUTTON_DispTimeCHNStr(pMsg->hWin, ID_TIMESET_BUTTON_TIMESET, 26, 18); BUTTON_DispTestSelCHNStr(pMsg->hWin, ID_TIMESET_BUTTON_TESTSELECT, 14, 18); // // Initialization of 'lwYear' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TIMESET_LISTWHEEL_YEAR); ListWheel_Init(hItem); ListWheel_AddNumString(hItem, 2015, 2025); // // Initialization of 'lwMonth' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TIMESET_LISTWHEEL_MONTH); ListWheel_Init(hItem); ListWheel_AddNumString(hItem, 1, 12); // // Initialization of 'lwDay' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TIMESET_LISTWHEEL_DAY); ListWheel_Init(hItem); ListWheel_AddNumString(hItem, 1, 31); // // Initialization of 'lwHour' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TIMESET_LISTWHEEL_HOUR); ListWheel_Init(hItem); ListWheel_AddNumString(hItem, 0, 23); // // Initialization of 'lwMin,lwSec' // for(i=ID_TIMESET_LISTWHEEL_MIN;i<=ID_TIMESET_LISTWHEEL_SEC;i++){ hItem = WM_GetDialogItem(pMsg->hWin, i); ListWheel_Init(hItem); ListWheel_AddNumString(hItem, 0, 59); } // // Initialization of 'edit' // for(i=ID_TIMESET_EDIT_SETVALUE;i<=ID_TIMESET_EDIT_SEC;i++){ hItem = WM_GetDialogItem(pMsg->hWin, i); EDIT_SetFont(hItem, GUI_FONT_24_ASCII); EDIT_SetTextMode(hItem); EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); } hItem = WM_GetDialogItem(pMsg->hWin, ID_TIMESET_EDIT_SETVALUE); EDIT_SetMaxLen(hItem, 30); hItem = WM_GetDialogItem(pMsg->hWin, ID_TIMESET_EDIT_ACTVALUE); EDIT_SetMaxLen(hItem, 30); WM_HideWin(pMsg->hWin); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(Id) { case ID_TIMESET_BUTTON_CONFIRM: // Notifications sent by 'Confirm' switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: Button_ConfirmProc(pMsg->hWin); break; } break; case ID_TIMESET_BUTTON_CHECK: // Notifications sent by 'Check' switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: Button_CheckProc(pMsg->hWin); break; } break; case ID_TIMESET_BUTTON_RESET: // Notifications sent by 'Reset' switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: Button_ResetProc(pMsg->hWin); break; } break; case ID_TIMESET_BUTTON_CANCEL: // Notifications sent by 'Cancel' switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: Button_CancelProc(pMsg->hWin); break; } break; case ID_TIMESET_BUTTON_SNSET: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: Button_SNSetProc(pMsg->hWin); break; } break; case ID_TIMESET_BUTTON_TESTSELECT: switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: Button_TestSelSetProc(pMsg->hWin); break; } break; case ID_TIMESET_LISTWHEEL_YEAR: // Notifications sent by 'lwYear' switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: break; case WM_NOTIFICATION_SEL_CHANGED: ListWheel_SelChangeProc(pMsg->hWin, ID_TIMESET_LISTWHEEL_YEAR, ID_TIMESET_EDIT_YEAR); break; } break; case ID_TIMESET_LISTWHEEL_MONTH: // Notifications sent by 'lwMonth' switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: break; case WM_NOTIFICATION_SEL_CHANGED: ListWheel_SelChangeProc(pMsg->hWin, ID_TIMESET_LISTWHEEL_MONTH, ID_TIMESET_EDIT_MONTH); break; } break; case ID_TIMESET_LISTWHEEL_DAY: // Notifications sent by 'lwDay' switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: break; case WM_NOTIFICATION_SEL_CHANGED: ListWheel_SelChangeProc(pMsg->hWin, ID_TIMESET_LISTWHEEL_DAY, ID_TIMESET_EDIT_DAY); break; } break; case ID_TIMESET_LISTWHEEL_HOUR: // Notifications sent by 'lwHour' switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: break; case WM_NOTIFICATION_SEL_CHANGED: ListWheel_SelChangeProc(pMsg->hWin, Id, ID_TIMESET_EDIT_HOUR); break; } break; case ID_TIMESET_LISTWHEEL_MIN: // Notifications sent by 'lwMin' switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: break; case WM_NOTIFICATION_SEL_CHANGED: ListWheel_SelChangeProc(pMsg->hWin, Id, ID_TIMESET_EDIT_MIN); break; } break; case ID_TIMESET_LISTWHEEL_SEC: // Notifications sent by 'lwSec' switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: break; case WM_NOTIFICATION_SEL_CHANGED: ListWheel_SelChangeProc(pMsg->hWin, Id, ID_TIMESET_EDIT_SEC); break; } break; } default: WM_DefaultProc(pMsg); break; } }
void MeasureData_InitDialog (WM_MESSAGE* pMsg) { WM_HWIN hWin = pMsg->hWin; // //FRAMEWIN // FRAMEWIN_SetBarColor(hWin, 1, 0xff901e); FRAMEWIN_SetClientColor(hWin, 0xc0c0c0); FRAMEWIN_SetTextColor(hWin, 0xcc3299); FRAMEWIN_SetFont(hWin, &GUI_Font16B_ASCII); FRAMEWIN_SetTextAlign(hWin, GUI_TA_VCENTER | GUI_TA_CENTER); FRAMEWIN_AddCloseButton(hWin, FRAMEWIN_BUTTON_RIGHT, 0); FRAMEWIN_AddMaxButton(hWin, FRAMEWIN_BUTTON_RIGHT, 1); FRAMEWIN_AddMinButton(hWin, FRAMEWIN_BUTTON_RIGHT, 2); FRAMEWIN_SetTitleHeight(hWin, 16); // //GUI_ID_TEXT0 // TEXT_SetBkColor(WM_GetDialogItem(hWin, GUI_ID_TEXT0), 0xc0c0c0); TEXT_SetTextColor(WM_GetDialogItem(hWin, GUI_ID_TEXT0), 0x228b22); TEXT_SetFont(WM_GetDialogItem(hWin, GUI_ID_TEXT0), &GUI_Font24B_ASCII); // //GUI_ID_TEXT2 // TEXT_SetBkColor(WM_GetDialogItem(hWin, GUI_ID_TEXT2), 0xc0c0c0); TEXT_SetTextColor(WM_GetDialogItem(hWin, GUI_ID_TEXT2), 0x4763ff); TEXT_SetFont(WM_GetDialogItem(hWin, GUI_ID_TEXT2), &GUI_Font24B_ASCII); // //GUI_ID_TEXT1 // TEXT_SetBkColor(WM_GetDialogItem(hWin, GUI_ID_TEXT1), 0xc0c0c0); TEXT_SetTextColor(WM_GetDialogItem(hWin, GUI_ID_TEXT1), 0xe16941); TEXT_SetFont(WM_GetDialogItem(hWin, GUI_ID_TEXT1), &GUI_Font24B_ASCII); // //GUI_ID_EDIT1 // EDIT_SetFont(WM_GetDialogItem(hWin, GUI_ID_EDIT1), &GUI_Font24B_ASCII); EDIT_SetTextAlign(WM_GetDialogItem(hWin, GUI_ID_EDIT1), GUI_TA_VCENTER | GUI_TA_LEFT); // //GUI_ID_EDIT2 // EDIT_SetFont(WM_GetDialogItem(hWin, GUI_ID_EDIT2), &GUI_Font24B_ASCII); EDIT_SetTextAlign(WM_GetDialogItem(hWin, GUI_ID_EDIT2), GUI_TA_VCENTER | GUI_TA_LEFT); // //GUI_ID_EDIT3 // EDIT_SetFont(WM_GetDialogItem(hWin, GUI_ID_EDIT3), &GUI_Font24B_ASCII); EDIT_SetTextAlign(WM_GetDialogItem(hWin, GUI_ID_EDIT3), GUI_TA_VCENTER | GUI_TA_LEFT); // //GUI_ID_EDIT4 // EDIT_SetTextColor(WM_GetDialogItem(hWin, GUI_ID_EDIT4), 0, 0x228b22); EDIT_SetFont(WM_GetDialogItem(hWin, GUI_ID_EDIT4), &GUI_Font24B_ASCII); EDIT_SetTextAlign(WM_GetDialogItem(hWin, GUI_ID_EDIT4), GUI_TA_VCENTER | GUI_TA_CENTER); // //GUI_ID_EDIT5 // EDIT_SetTextColor(WM_GetDialogItem(hWin, GUI_ID_EDIT5), 0, 0xff901e); EDIT_SetFont(WM_GetDialogItem(hWin, GUI_ID_EDIT5), &GUI_Font24B_ASCII); EDIT_SetTextAlign(WM_GetDialogItem(hWin, GUI_ID_EDIT5), GUI_TA_VCENTER | GUI_TA_CENTER); // //GUI_ID_EDIT6 // EDIT_SetTextColor(WM_GetDialogItem(hWin, GUI_ID_EDIT6), 0, 0x4763ff); EDIT_SetFont(WM_GetDialogItem(hWin, GUI_ID_EDIT6), &GUI_Font24B_ASCII); EDIT_SetTextAlign(WM_GetDialogItem(hWin, GUI_ID_EDIT6), GUI_TA_VCENTER | GUI_TA_CENTER); }
/********************************************************************* * * _cbDialog */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int NCode; int Id; // USER START (Optionally insert additional variables) // USER END GUI_DrawBitmap(&bmlogo,40,10); #if(Gradient_Rectangle) { GUI_DrawGradientRoundedH(220,120,580,380,20,REC_color1,REC_color2); } #endif #if(RoundedFrame) GUI_SetColor(GUI_GREEN); GUI_DrawRoundedFrame(218,118,582,382,20,3); #endif #if(FillRoundedRect) GUI_SetColor(RoundedRect); GUI_FillRoundedRect(220,120,580,380,20); #endif switch (pMsg->MsgId) { case WM_INIT_DIALOG: // // Initialization of 'ICcard' // hItem = pMsg->hWin; FRAMEWIN_SetTitleVis(hItem, 0); FRAMEWIN_SetClientColor( hItem, BACKCOLOR); FRAMEWIN_SetFont(hItem, GUI_FONT_8_1); FRAMEWIN_SetText(hItem, "Framewin"); FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); FRAMEWIN_SetTextColor(hItem, 0x00000000); // // Initialization of 'Button' // // hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0); // BUTTON_SetFont(hItem, &GUI_Fonthz_song30); // BUTTON_SetText(hItem, "返回 "); // #if(Button_3Dskin) // BUTTON_SetSkin(hItem,BUTTON_SKIN_FLEX); //#endif //#if(!Button_3Dskin) // BUTTON_SetBkColor( hItem,BUTTON_CI_UNPRESSED,Button_unpress_color); // BUTTON_SetBkColor( hItem,BUTTON_CI_PRESSED,Button_press_color); //#endif // // Initialization of 'Button' // // hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1); // BUTTON_SetFont(hItem, GUI_FONT_13_1); // BUTTON_SetText(hItem, "exit"); //#if(Button_3Dskin) // BUTTON_SetSkin(hItem,BUTTON_SKIN_FLEX); //#endif //#if(!Button_3Dskin) // BUTTON_SetBkColor( hItem,BUTTON_CI_UNPRESSED,Button_unpress_color); // BUTTON_SetBkColor( hItem,BUTTON_CI_PRESSED,Button_press_color); //#endif hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0); TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_TOP); TEXT_SetText(hItem, "安徽绿建科技有限公司 "); TEXT_SetTextColor(hItem, 0x00000000); TEXT_SetFont(hItem, &GUI_FontSong_60); // // Initialization of 'Text' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1); TEXT_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_TOP); TEXT_SetTextColor(hItem, 0x00000000); TEXT_SetText(hItem, "ANHUI GREEN BUILDING TECHNOLOGY CO.,LTD."); TEXT_SetFont(hItem, GUI_FONT_24_ASCII); // // Initialization of 'Text' // hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2); TEXT_SetFont(hItem, &GUI_Fonthz_song30); TEXT_SetWrapMode(hItem,GUI_WRAPMODE_WORD); TEXT_SetText(hItem, "您好像没有刷卡,系统将在2S后自动退出 "); TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); TEXT_SetTextColor(hItem, 0x00FFFFFF); // 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 'Button' 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_BUTTON_1: // Notifications sent by 'Button' 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; // 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; } }
/***************************** Peremaljovuvannja paneli comunicaciji *****************************/ void redraw_panel_Modbus(void) { EDIT_SetText(hEdit, _aBitmapItem_Comm[COMM_MODBUS_ID].pExplanation[sel_language]); char title[256]; title[0] = '\0'; strcat_mal(title, (char *)Modbus_panel_title.ptitle[sel_language]); unsigned int error_data_1 = _CHECK_SET_BIT(diagnostyka, ERROR_SETTINGS_BS_EEPROM_BIT) | _CHECK_SET_BIT(diagnostyka, ERROR_SETTINGS_BS_EEPROM_EMPTY_BIT); if (error_data_1) { //Nalashtuvannja nemaje u tablyci nalashtuvan strcat_mal(title, (char *)ERROR_MES.ptitle[sel_language]); FRAMEWIN_SetText(Modbus_FrameWin, title); FRAMEWIN_SetBarColor(Modbus_FrameWin, 1, GUI_RED); FRAMEWIN_SetTextColor(Modbus_FrameWin, GUI_YELLOW); EDIT_SetText(Modbus_v[0], ""); DROPDOWN_SetSel(Modbus_v[1], 0); DROPDOWN_SetSel(Modbus_v[2], 0); DROPDOWN_SetSel(Modbus_v[3], 0); EDIT_SetText(Modbus_v[4], ""); } else { //Nalashtuvannja realno je u tablyci nalashtuvan if (current_ekran.edition != 0) { strcat_mal(title, (char *)MODE.ptitle[sel_language]); if (current_ekran.edition != 1) { //Помічаємо, що дані змінені strcat_mal(title, "*"); } } FRAMEWIN_SetText(Modbus_FrameWin, title); if (current_ekran.edition == 0) { FRAMEWIN_SetBarColor(Modbus_FrameWin, 1, GUI_GREEN); FRAMEWIN_SetTextColor(Modbus_FrameWin, GUI_BLUE); } else { FRAMEWIN_SetBarColor(Modbus_FrameWin, 1, GUI_YELLOW); FRAMEWIN_SetTextColor(Modbus_FrameWin, GUI_RED); } AuxCfgTbl1Dsc *point_1; if (current_ekran.edition == 0) point_1 = &eeprom_bs_settings_tbl; else point_1 = &edit_settings_1; __info_data info_data; U8 Flags; EDIT_GetUserData(Modbus_v[0], &info_data, sizeof(__info_data)); Flags = GUI_EDIT_SUPPRESS_LEADING_ZEROES; if (current_ekran.edition != 0) { if ((info_data.extra_param & FLAG_SIGNED_FATA) != 0) Flags = GUI_EDIT_SIGNED; else Flags = 0; } EDIT_SetFloatMode(Modbus_v[0], point_1->RS_comm_addres, info_data.min, info_data.max, info_data.shift, Flags); int value_int = point_1->RS_comm_addres; if ((value_int >= KOEF_ADDRESS_MIN) && (value_int <= KOEF_ADDRESS_MAX)) { EDIT_SetTextColor(Modbus_v[0], EDIT_CI_DISABLED, GUI_BLACK); EDIT_SetTextColor(Modbus_v[0], EDIT_CI_ENABLED, GUI_BLACK); } else { EDIT_SetTextColor(Modbus_v[0], EDIT_CI_DISABLED, GUI_RED); EDIT_SetTextColor(Modbus_v[0], EDIT_CI_ENABLED, GUI_RED); } DROPDOWN_SetSel(Modbus_v[1], point_1->chSpeed + 1); DROPDOWN_SetSel(Modbus_v[2], point_1->chParityCheck + 1); DROPDOWN_SetSel(Modbus_v[3], point_1->chAmtStopBit - 1 + 1); EDIT_GetUserData(Modbus_v[4], &info_data, sizeof(__info_data)); Flags = GUI_EDIT_SUPPRESS_LEADING_ZEROES; if (current_ekran.edition != 0) { if ((info_data.extra_param & FLAG_SIGNED_FATA) != 0) Flags = GUI_EDIT_SIGNED; else Flags = 0; } EDIT_SetFloatMode(Modbus_v[4], (float)point_1->chTimeOut_RS/10, info_data.min, info_data.max, info_data.shift, Flags); value_int = point_1->chTimeOut_RS; if ((value_int >= VALUE_TIME_OUT_1_INTERFACE_MIN) && (value_int <= VALUE_TIME_OUT_1_INTERFACE_MAX)) { EDIT_SetTextColor(Modbus_v[4], EDIT_CI_DISABLED, GUI_BLACK); EDIT_SetTextColor(Modbus_v[4], EDIT_CI_ENABLED, GUI_BLACK); } else { EDIT_SetTextColor(Modbus_v[4], EDIT_CI_DISABLED, GUI_RED); EDIT_SetTextColor(Modbus_v[4], EDIT_CI_ENABLED, GUI_RED); } } WM_HWIN FocussedWindow = (Modbus_v[0 + current_ekran.index_position_1]); WM_SetFocus(FocussedWindow); }
/***************************** Initializacija paneli comunikaciji *****************************/ void Modbus_panel_show(void) { if (Modbus_FrameWin == WM_UNATTACHED) { //Stvorjujemo FrameWin Modbus_FrameWin = FRAMEWIN_CreateEx(X0, Y0, X_SIZE, Y_SIZE, 0, WM_CF_HIDE, 0, ID_MODBUS_FRAMEWIN, Modbus_panel_title.ptitle[sel_language], _cbProtection_FrameWin); FRAMEWIN_SetFont(Modbus_FrameWin, &GUI_FontArialBold14_8_Unicode); FRAMEWIN_SetTextAlign(Modbus_FrameWin, GUI_TA_HCENTER); FRAMEWIN_SetBarColor(Modbus_FrameWin, 1, GUI_GREEN); FRAMEWIN_SetBarColor(Modbus_FrameWin, 0, GUI_LIGHTGRAY); FRAMEWIN_SetTextColor(Modbus_FrameWin, GUI_BLUE); #define COL_1_X 5 #define ROW_1_Y 10 #define HIGHT_Y 20 #define SHIFT_Y (ROW_1_Y + HIGHT_Y) #define WIDTH_X_T 165 #define WIDTH_X_V 60 #define SHIFT_X1 (WIDTH_X_T + 10) #define SHIFT_X2 (SHIFT_X1 + WIDTH_X_V + 10) ScrollBar_Modbus = SCROLLBAR_CreateAttached(WM_GetClientWindow(Modbus_FrameWin), SCROLLBAR_CF_VERTICAL); SCROLLBAR_SetNumItems(ScrollBar_Modbus, MAX_NUMBER_ITEMS_MODBUS*SHIFT_Y); SCROLLBAR_SetPageSize(ScrollBar_Modbus, 6*SHIFT_Y); //Address Modbus_t[0] = TEXT_CreateEx(COL_1_X, ROW_1_Y + 0*SHIFT_Y, WIDTH_X_T, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, TEXT_CF_LEFT | TEXT_CF_VCENTER, ID_MODBUS_ADDRESS_TITLE, Modbus_title[0].ptitle[sel_language]); TEXT_SetFont(Modbus_t[0], &GUI_FontArialStandard14_8_Unicode); Modbus_v[0] = EDIT_CreateUser(COL_1_X + SHIFT_X1, ROW_1_Y + 0*SHIFT_Y, WIDTH_X_V, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, 0, ID_MODBUS_ADDRESS_VALUE, 3, sizeof(__info_data)); EDIT_SetFont(Modbus_v[0], &GUI_FontArialStandard14_8_Unicode); __info_data info_data; int shift = 0, max = KOEF_ADDRESS_MAX, min = 0; info_data.extra_param = 0; info_data.shift = shift; float _shift = 0.0f; for (int rozrjad = 0; rozrjad < shift; rozrjad++) { _shift /= 10.0f; _shift += 0.9f; } // int max_tmp = max; // float _max = 10; // while ( abs(max_tmp /= 10) >= 1) _max *= 10.0f; // if (max > 0) // { // _max = _max - 1 + _shift; // } // else if (max < 0) // { // _max = -(_max / 10); // } // else _max = 0; // info_data.max = _max; float _max = 255; //maksymalne odnobajtne chyslo, bo adresu ob'javleno jak typ char info_data.max = _max; int min_tmp = min; float _min = 10; while ( abs(min_tmp /= 10) >= 1) _min *= 10.0f; if (min > 0) { _min = (_min / 10); } else if (min < 0) { _min = -(_min - 1 + _shift); } else _min = 0; info_data.min = _min; EDIT_SetUserData(Modbus_v[0], &info_data, sizeof(__info_data)); EDIT_SetFloatMode(Modbus_v[0], 0, _min, _max, shift, GUI_EDIT_SUPPRESS_LEADING_ZEROES); //Baud Rate Modbus_t[1] = TEXT_CreateEx(COL_1_X, ROW_1_Y + 1*SHIFT_Y, WIDTH_X_T, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, TEXT_CF_LEFT | TEXT_CF_VCENTER, ID_MODBUS_BAUD_RATE_TITLE, Modbus_title[1].ptitle[sel_language]); TEXT_SetFont(Modbus_t[1], &GUI_FontArialStandard14_8_Unicode); Modbus_v[1] = DROPDOWN_CreateEx(COL_1_X + SHIFT_X1, ROW_1_Y + 1*SHIFT_Y, WIDTH_X_V, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, DROPDOWN_CF_AUTOSCROLLBAR, ID_MODBUS_BAUD_RATE_VALUE); DROPDOWN_SetFont(Modbus_v[1], &GUI_FontArialStandard14_8_Unicode); DROPDOWN_SetBkColor(Modbus_v[1],DROPDOWN_CI_UNSEL, GUI_GRAY); DROPDOWN_SetBkColor(Modbus_v[1],DROPDOWN_CI_SEL, GUI_GRAY); DROPDOWN_SetBkColor(Modbus_v[1],DROPDOWN_CI_SELFOCUS, GUI_BLUE); DROPDOWN_AddString(Modbus_v[1], ""); for (int i = 0; i < 7; i++) DROPDOWN_AddString(Modbus_v[1], Baud_rate_title[i]); //Parity Modbus_t[2] = TEXT_CreateEx(COL_1_X, ROW_1_Y + 2*SHIFT_Y, WIDTH_X_T, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, TEXT_CF_LEFT | TEXT_CF_VCENTER, ID_MODBUS_PARITY_TITLE, Modbus_title[2].ptitle[sel_language]); TEXT_SetFont(Modbus_t[2], &GUI_FontArialStandard14_8_Unicode); Modbus_v[2] = DROPDOWN_CreateEx(COL_1_X + SHIFT_X1, ROW_1_Y + 2*SHIFT_Y, WIDTH_X_V, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, DROPDOWN_CF_AUTOSCROLLBAR, ID_MODBUS_PARITY_VALUE); DROPDOWN_SetFont(Modbus_v[2], &GUI_FontArialStandard14_8_Unicode); DROPDOWN_SetBkColor(Modbus_v[2],DROPDOWN_CI_UNSEL, GUI_GRAY); DROPDOWN_SetBkColor(Modbus_v[2],DROPDOWN_CI_SEL, GUI_GRAY); DROPDOWN_SetBkColor(Modbus_v[2],DROPDOWN_CI_SELFOCUS, GUI_BLUE); DROPDOWN_AddString(Modbus_v[2], ""); for (int i = 0; i < 3; i++) DROPDOWN_AddString(Modbus_v[2], Parity_title[i].ptitle[sel_language]); //Stop bits Modbus_t[3] = TEXT_CreateEx(COL_1_X, ROW_1_Y + 3*SHIFT_Y, WIDTH_X_T, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, TEXT_CF_LEFT | TEXT_CF_VCENTER, ID_MODBUS_STOP_BITS_TITLE, Modbus_title[3].ptitle[sel_language]); TEXT_SetFont(Modbus_t[3], &GUI_FontArialStandard14_8_Unicode); Modbus_v[3] = DROPDOWN_CreateEx(COL_1_X + SHIFT_X1, ROW_1_Y + 3*SHIFT_Y, WIDTH_X_V, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, DROPDOWN_CF_AUTOSCROLLBAR, ID_MODBUS_STOP_BITS_VALUE); DROPDOWN_SetFont(Modbus_v[3], &GUI_FontArialStandard14_8_Unicode); DROPDOWN_SetBkColor(Modbus_v[3],DROPDOWN_CI_UNSEL, GUI_GRAY); DROPDOWN_SetBkColor(Modbus_v[3],DROPDOWN_CI_SEL, GUI_GRAY); DROPDOWN_SetBkColor(Modbus_v[3],DROPDOWN_CI_SELFOCUS, GUI_BLUE); DROPDOWN_AddString(Modbus_v[3], ""); for (int i = 0; i < 2; i++) DROPDOWN_AddString(Modbus_v[3], Stop_bits_title[i]); //Time-Out Modbus_t[4] = TEXT_CreateEx(COL_1_X, ROW_1_Y + 4*SHIFT_Y, WIDTH_X_T, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, TEXT_CF_LEFT | TEXT_CF_VCENTER, ID_MODBUS_TIMEOUT_TITLE, Modbus_title[4].ptitle[sel_language]); TEXT_SetFont(Modbus_t[4], &GUI_FontArialStandard14_8_Unicode); Modbus_v[4] = EDIT_CreateUser(COL_1_X + SHIFT_X1, ROW_1_Y + 4*SHIFT_Y, WIDTH_X_V, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, 0, ID_MODBUS_TIMEOUT_VALUE, 5, sizeof(__info_data)); EDIT_SetFont(Modbus_v[4], &GUI_FontArialStandard14_8_Unicode); shift = 1; max = VALUE_TIME_OUT_1_INTERFACE_MAX/10; min = 0; info_data.extra_param = 0; info_data.shift = shift; _shift = 0.0f; for (int rozrjad = 0; rozrjad < shift; rozrjad++) { _shift /= 10.0f; _shift += 0.9f; } int max_tmp = max; _max = 10; while ( abs(max_tmp /= 10) >= 1) _max *= 10.0f; if (max > 0) { _max = _max - 1 + _shift; } else if (max < 0) { _max = -(_max / 10); } else _max = 0; info_data.max = _max; min_tmp = min; _min = 10; while ( abs(min_tmp /= 10) >= 1) _min *= 10.0f; if (min > 0) { _min = (_min / 10); } else if (min < 0) { _min = -(_min - 1 + _shift); } else _min = 0; info_data.min = _min; EDIT_SetUserData(Modbus_v[4], &info_data, sizeof(__info_data)); EDIT_SetFloatMode(Modbus_v[4], 0, _min, _max, shift, GUI_EDIT_SUPPRESS_LEADING_ZEROES); Modbus_d = TEXT_CreateEx(COL_1_X + SHIFT_X2 , ROW_1_Y + 4*SHIFT_Y, 40, HIGHT_Y, WM_GetClientWindow(Modbus_FrameWin), WM_CF_SHOW, TEXT_CF_LEFT | TEXT_CF_VCENTER, ID_MODBUS_TIMEOUT_DIMENSION, Modbus_Timeout_dimention.ptitle[sel_language]); TEXT_SetFont(Modbus_d, &GUI_FontArialStandard14_8_Unicode); #undef COL_1_X #undef ROW_1_Y #undef HIGHT_Y #undef SHIFT_Y #undef WIDTH_X_T #undef WIDTH_X_V #undef SHIFT_X1 #undef SHIFT_X2 } WM_BringToTop(Modbus_FrameWin); WM_ShowWindow(Modbus_FrameWin); }
/********************************************************************* * * _cbDialog */ static void _cbDialog(WM_MESSAGE * pMsg) { WM_HWIN hItem; int Id, NCode; // USER START (Optionally insert additional variables) // USER END switch (pMsg->MsgId) { case WM_INIT_DIALOG: // // Initialization of 'Framewin' // hItem = pMsg->hWin; FRAMEWIN_SetTitleHeight(hItem, 20); FRAMEWIN_SetText(hItem, "Framewin"); FRAMEWIN_SetFont(hItem, GUI_FONT_13B_ASCII); FRAMEWIN_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER); FRAMEWIN_SetTextColor(hItem, 0x00FF0000); // // Initialization of 'Edit' // hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0); EDIT_SetText(hItem, "123"); // // Initialization of 'Button' // hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0); BUTTON_SetText(hItem, "Browse"); // // Initialization of 'Button' // hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1); BUTTON_SetText(hItem, "Start"); // // Initialization of 'Checkbox' // hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_0); CHECKBOX_SetText(hItem, "Check-1"); // // Initialization of 'Checkbox' // hItem = WM_GetDialogItem(pMsg->hWin, ID_CHECKBOX_1); CHECKBOX_SetText(hItem, "Check-2"); // 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_EDIT_0: // Notifications sent by 'Edit' 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; case ID_BUTTON_0: // Notifications sent by 'Button' 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_BUTTON_1: // Notifications sent by 'Button' 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_CHECKBOX_0: // Notifications sent by 'Checkbox' 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; case ID_CHECKBOX_1: // Notifications sent by 'Checkbox' 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; 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; } }
/********************************************************************* * * _cbDialog */ static void _cbDialogBrowser(WM_MESSAGE * pMsg) { TREEVIEW_ITEM_Handle hNode; //结点句柄 TREEVIEW_ITEM_INFO ItemInfo; WM_HWIN hItem; int NCode; int Id; // USER START (Optionally insert additional variables) SCROLLBAR_Handle hScrollbar; // USER END switch (pMsg->MsgId) { case WM_DELETE: ltk_printf("Browserapp delete\n"); record_file=0; _CreateFrame(&_cbIndex); break; case WM_INIT_DIALOG: // // Initialization of 'Browser' // hItem = pMsg->hWin; FRAMEWIN_SetTextColor(hItem,GUI_WHITE); FRAMEWIN_SetFont(hItem, GUI_FONT_20B_ASCII); FRAMEWIN_SetTextAlign(hItem, GUI_TA_LEFT | GUI_TA_VCENTER); FRAMEWIN_AddCloseButton(hItem,FRAMEWIN_BUTTON_RIGHT,0); // FRAMEWIN_AddMaxButton(hItem, FRAMEWIN_BUTTON_RIGHT, 1); // FRAMEWIN_AddMinButton(hItem, FRAMEWIN_BUTTON_RIGHT, 2); FRAMEWIN_SetTitleHeight(hItem, 25); // // Initialization of 'FileTree' // GUI_UC_SetEncodeNone(); hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_TREEVIEW0); TREEVIEW_SetFont(hItem,&GUI_FontHZ16); // TREEVIEW_SetAutoScrollH(hItem,1); // TREEVIEW_SetAutoScrollV(hItem,1); hScrollbar = SCROLLBAR_CreateAttached(hItem,SCROLLBAR_CF_VERTICAL); //创建窗口的子控件 SCROLLBAR_SetWidth(hScrollbar,20); //设置滚动条宽度为20 TREEVIEW_SetSelMode(hItem, TREEVIEW_SELMODE_ROW); //使用自动滚动条 hNode = TREEVIEW_InsertItem(hItem, TREEVIEW_ITEM_TYPE_NODE, 0, 0, "SDCard[0:]"); // USER START (Optionally insert additional code for further widget initialization) if( SD_OK != c_sdReader_init()) ltk_printf("sd card init failed\r\n"); Fill_FileList("0:",record_file,hItem,hNode,NULL); TREEVIEW_ITEM_Expand(hNode); // USER END break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(Id) { case GUI_ID_TREEVIEW0: // Notifications sent by 'FileTree' switch(NCode) { case WM_NOTIFICATION_CLICKED: break; case WM_NOTIFICATION_RELEASED: // USER START (Optionally insert code for reacting on notification message) //printf("\n release\n"); /* 查看选中了哪个项目 */ hNode = TREEVIEW_GetSel(pMsg->hWinSrc); /* 获取该项目的信息 */ TREEVIEW_ITEM_GetInfo(hNode,&ItemInfo); if(ItemInfo.IsNode == 0) //点击的是目录树的叶子(即文件) { //printf("\r\nleaf num =%ld",hNode); OpenFileProcess(hNode,record_file); } // else //结点 // { // printf("\r\nnode num =%ld",hNode); // } // USER END break; case WM_NOTIFICATION_MOVED_OUT: // USER START (Optionally insert code for reacting on notification message) // USER END break; case WM_NOTIFICATION_SEL_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; } }