/********************************************************************* * * MainTask */ void MainTask(void) { GUI_Init(); // // Check if recommended memory for the sample is available // if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { GUI_ErrorOut("Not enough memory available."); return; } #if GUI_SUPPORT_MEMDEV WM_SetCreateFlags(WM_CF_MEMDEV); #endif WM_SetCallback(WM_HBKWIN, &_cbBkWindow); // // Create message box and wait until it is closed // while (1) { GUI_MessageBox("This text is shown\nin a message box", "Caption/Title", GUI_MESSAGEBOX_CF_MOVEABLE); GUI_Delay(750); // Wait for a short moment ... GUI_MessageBox("New message !", "Caption/Title", GUI_MESSAGEBOX_CF_MOVEABLE); GUI_Delay(750); } }
/********************************************************************* * * MainTask */ void MainTask(void) { WM_SetCreateFlags(WM_CF_MEMDEV); // Use memory devices on all windows to avoid flicker GUI_Init(); // // Check if recommended memory for the sample is available // if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { GUI_ErrorOut("Not enough memory available."); return; } AzimuthalMotor.dutyCycle(0); AzimuthalMotor.start(); VerticalMotor.dutyCycle(0); VerticalMotor.start(); ClawMotor.dutyCycle(0); ClawMotor.start(); WM_SetCallback(WM_HBKWIN, _cbBkWindow); while (1) { GUI_ExecDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbCallback, 0, 0, 0); GUI_Delay(1000); } }
/******************************************************************* * * MainTask */ void MainTask(void) { int xPos; int yPos; int xSize; int i; i = 0; GUI_Init(); // // Check if recommended memory for the sample is available // if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { GUI_ErrorOut("Not enough memory available."); return; } xPos = LCD_GetXSize() / 2; yPos = LCD_GetYSize() / 3; GUI_SetTextMode(GUI_TM_REV); GUI_SetFont(GUI_FONT_20F_ASCII); GUI_DispStringHCenterAt("Hello world!", xPos, yPos); GUI_SetFont(GUI_FONT_D24X32); xSize = GUI_GetStringDistX("0000"); xPos -= xSize / 2; yPos += 24 + 10; while (1) { GUI_DispDecAt( i++, xPos, yPos, 4); if (i > 9999) { i = 0; } } }
/** * @brief Start task * @param argument: pointer that is passed to the thread function as start argument. * @retval None */ static void GUIThread(void const * argument) { /* Check for calibration */ if(k_CalibrationIsDone() == 0) { k_CalibrationInit(); } /* Demo Startup */ k_StartUp(); /* Initialize Storage Units */ k_StorageInit(); /* Initialize audio Interface */ k_BspAudioInit(); /* Show the main menu */ k_InitMenu(); /* Gui background Task */ while(1) { GUI_Exec(); /* Do the background work ... Update windows etc.) */ osDelay(20); /* Nothing left to do for the moment ... Idle processing */ GUI_FreeMem = GUI_ALLOC_GetNumFreeBytes(); } }
/** * @brief Start task * @param argument: pointer that is passed to the thread function as start argument. * @retval None */ static void GUIThread(void const * argument) { /* Initialize Storage Units */ k_StorageInit(); if(k_CalibrationIsDone() == 0) { k_CalibrationInit(); } /* Demo Startup */ k_StartUp(); /* Show the main menu */ k_InitMenu(); /* Gui background Task */ while(1) { GUI_Exec(); /* Toggle LED3 and LED4 */ BSP_LED_Toggle(LED3); BSP_LED_Toggle(LED4); osDelay(20); GUI_FreeMem = GUI_ALLOC_GetNumFreeBytes(); } }
/********************************************************************* * * MainTask */ void CreateWindow(void) { WM_HWIN hMultiPage; WM_HWIN hFrameWin; WM_HWIN hDialog; // // Check if recommended memory for the sample is available // if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { GUI_ErrorOut("Not enough memory available."); return; } WM_SetCallback(WM_HBKWIN, _cbBkWindow); // // Create the frame window // hFrameWin = FRAMEWIN_Create("Sample", NULL, WM_CF_SHOW, 0, 0, 240, 152); FRAMEWIN_SetClientColor(hFrameWin, GUI_GREEN); FRAMEWIN_SetActive(hFrameWin, 1); FRAMEWIN_SetMoveable(hFrameWin, 1); // // Create the MULTIPAGE widget // hMultiPage = MULTIPAGE_CreateEx(7, 6, 220, 120, WM_GetClientWindow(hFrameWin), WM_CF_SHOW, 0, 0); GUI_Delay(500); // // Create and attach the MULTIPAGE dialog windows // hDialog = GUI_CreateDialogBox(_aDialogCreate1, GUI_COUNTOF(_aDialogCreate1), NULL, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 1"); GUI_Delay(500); hDialog = GUI_CreateDialogBox(_aDialogCreate2, GUI_COUNTOF(_aDialogCreate2), NULL, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 2"); GUI_Delay(500); hDialog = GUI_CreateDialogBox(_aDialogCreate3, GUI_COUNTOF(_aDialogCreate3), NULL, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 3"); GUI_Delay(500); hDialog = GUI_CreateDialogBox(_aDialogCreate4, GUI_COUNTOF(_aDialogCreate4), _cbDialog4, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 4"); GUI_Delay(500); hDialog = GUI_CreateDialogBox(_aDialogCreate5, GUI_COUNTOF(_aDialogCreate5), NULL, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 5"); GUI_Delay(500); hDialog = GUI_CreateDialogBox(_aDialogCreate6, GUI_COUNTOF(_aDialogCreate6), NULL, WM_UNATTACHED, 0, 0); MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 6"); GUI_Delay(500); // // Demonstrate the use of MULTIPAGE_SetAlign // MULTIPAGE_SetAlign(hMultiPage, MULTIPAGE_ALIGN_RIGHT); GUI_Delay(500); MULTIPAGE_SetAlign(hMultiPage, MULTIPAGE_ALIGN_RIGHT | MULTIPAGE_ALIGN_BOTTOM); GUI_Delay(500); MULTIPAGE_SetAlign(hMultiPage, MULTIPAGE_ALIGN_LEFT | MULTIPAGE_ALIGN_BOTTOM); while (1) { GUI_Delay(100); } }
/********************************************************************* * * MainTask */ void MainTask(void) { int Index; GUI_Init(); // // Check if recommended memory for the sample is available // if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { GUI_ErrorOut("Not enough memory available."); return; } #if GUI_SUPPORT_MEMDEV WM_SetCreateFlags(WM_CF_MEMDEV); #endif WM_SetDesktopColor(GUI_BLACK); // // Initialize the temperature arrays // _InitRandomData(_aTemp1, GUI_COUNTOF(_aTemp1)); _InitRandomData(_aTemp2, GUI_COUNTOF(_aTemp2)); // // Execute the intro dialog // GUI_ExecDialogBox(_aDialogIntro, GUI_COUNTOF(_aDialogIntro), _cbDialogIntro, WM_HBKWIN, 0, 0); // // Execute the color and the temperature dialog // _hDialogColor = GUI_CreateDialogBox(_aDialogColor, GUI_COUNTOF(_aDialogColor), _cbDialogColor, WM_HBKWIN, 0, 0); _hDialogMain = GUI_CreateDialogBox(_aDialogMain, GUI_COUNTOF(_aDialogMain), _cbDialogMain, WM_HBKWIN, 0, 0); // // Add new temperatures... // Index = GUI_COUNTOF(_aTemp1) - 1; while (1) { WM_HWIN hItem; GUI_Delay(100); // Wait a while // // Shift the color arrays // memmove(_aTemp1, _aTemp1 + 1, sizeof(_aTemp1) - 2); memmove(_aTemp2, _aTemp2 + 1, sizeof(_aTemp2) - 2); // // Add new values // _aTemp1[Index] = _GetRandomValue(_aTemp1[Index - 1]); _aTemp2[Index] = _GetRandomValue(_aTemp2[Index - 1]); // // Update windows // hItem = WM_GetClientWindow(WM_GetDialogItem(_hDialogMain, ID_TEMPERATURE)); WM_InvalidateWindow(hItem); _SetProgbarValue(GUI_ID_PROGBAR0, _aTemp1[Index]); _SetProgbarValue(GUI_ID_PROGBAR1, _aTemp2[Index]); } }
void MainTask(void) { static GUI_PID_STATE OldState; GUI_PID_STATE CurrentState; int tEnd; GUI_Init(); BUTTON_SetReactOnLevel(); // // Check if recommended memory for the sample is available // if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { GUI_ErrorOut("Not enough memory available."); return; } do { WM_HWIN hButton0, hButton1; WM_SetCallback(WM_HBKWIN, _cbBkWin); hButton0 = _CreateButton(100, 220, 170, 150, 5, 25, "Dashboard" , &bmDashboard , GUI_ID_BUTTON0); hButton1 = _CreateButton(370, 220, 170, 150, 5, 25, "Cash Terminal", &bmCashTerminal, GUI_ID_BUTTON1); WM_SetFocus(hButton0); tEnd = GUI_GetTime() + 4000; do { GUI_PID_GetState(&CurrentState); if ((OldState.x != CurrentState.x) || (OldState.y != CurrentState.y)) { tEnd = GUI_GetTime() + 10000; } OldState = CurrentState; GUI_Delay(100); if (GUI_GetTime() >= tEnd) { if (_AppSelectionOld) { _AppSelection = ((_AppSelectionOld - 1) ^ 1) + 1; } else { _AppSelection = APP_DASHBOARD; } } } while (!_AppSelection && !_Break); WM_DeleteWindow(hButton0); WM_DeleteWindow(hButton1); if (!_Break) { switch (_AppSelection) { case APP_DASHBOARD: AppDashBoard(); break; case APP_CASHTERMINAL: AppCashTerminal(); break; } GUI_CURSOR_Hide(); _AppSelectionOld = _AppSelection; _AppSelection = 0; } } while (!_Break); }
/********************************************************************* * * MainTask */ void MainTask(void) { WM_SetCreateFlags(WM_CF_MEMDEV); GUI_Init(); // // Check if recommended memory for the sample is available // if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { GUI_ErrorOut("Not enough memory available."); return; } _DemoTransWindow(); }
/********************************************************************* * * MainTask */ void MainTask(void) { GUI_Init(); // // Check if recommended memory for the sample is available // if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { GUI_ErrorOut("Not enough memory available."); return; } while (1) { _DrawJPEGsFromWindowsDir(); } }
/********************************************************************* * * GUIDEMO_Main */ void GUIDEMO_Main(void) { FRAMEWIN_SKINFLEX_PROPS Framewin_Props; #if GUIDEMO_USE_AUTO_BK int NumFreeBytes; int BitsPerPixel; #endif GUI_MEMDEV_SetAnimationCallback(_cbEffect, (void *)&_Pressed); WM_SetCallback(WM_HBKWIN, _cbBk); BUTTON_SetReactOnLevel(); FRAMEWIN_GetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_ACTIVE); Framewin_Props.Radius = 0; FRAMEWIN_SetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_ACTIVE); FRAMEWIN_GetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_INACTIVE); Framewin_Props.Radius = 0; FRAMEWIN_SetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_INACTIVE); FRAMEWIN_SetDefaultSkin (_FRAMEWIN_DrawSkinFlex); PROGBAR_SetDefaultSkin (PROGBAR_SKIN_FLEX); BUTTON_SetDefaultSkin (BUTTON_SKIN_FLEX); SCROLLBAR_SetDefaultSkin (SCROLLBAR_SKIN_FLEX); SLIDER_SetDefaultSkin (SLIDER_SKIN_FLEX); HEADER_SetDefaultSkin (HEADER_SKIN_FLEX); GUI_SetTextMode (GUI_TM_TRANS); GUIDEMO_Config(&_GUIDemoConfig); #if GUIDEMO_USE_VNC if (GUIDEMO_GetConfFlag(GUIDEMO_CF_USE_VNC)) { _GUIDemoConfig.pGUI_VNC_X_StartServer(0, 0); } #endif #if GUIDEMO_USE_AUTO_BK // // Determine if HW has enough memory to draw the gradient circle as background // BitsPerPixel = LCD_GetBitsPerPixel(); if ((BitsPerPixel >= 16) && GUIDEMO_GetConfFlag(GUIDEMO_CF_USE_AUTO_BK)) { NumFreeBytes = GUI_ALLOC_GetNumFreeBytes(); if (NumFreeBytes > NUMBYTES_NEEDED) { _pfDrawBk = _DrawBkCircle; } else { _pfDrawBk = _DrawBk; } } else #endif { _pfDrawBk = _DrawBkSimple; } GUIDEMO_SetDrawLogo(1); while (1) { _Main(); } }
/********************************************************************* * * GUIDEMO_Main */ void GUIDEMO_Main(void) { FRAMEWIN_SKINFLEX_PROPS Framewin_Props; #if AUTO_BK int NumFreeBytes; int BitsPerPixel; #endif GUI_MEMDEV_SetAnimationCallback(_cbEffect, (void *)&_Pressed); WM_SetCallback(WM_HBKWIN, _cbBk); BUTTON_SetReactOnLevel(); FRAMEWIN_GetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_ACTIVE); Framewin_Props.Radius = 0; FRAMEWIN_SetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_ACTIVE); FRAMEWIN_GetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_INACTIVE); Framewin_Props.Radius = 0; FRAMEWIN_SetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_INACTIVE); FRAMEWIN_SetDefaultSkin (_FRAMEWIN_DrawSkinFlex); PROGBAR_SetDefaultSkin (PROGBAR_SKIN_FLEX); BUTTON_SetDefaultSkin (BUTTON_SKIN_FLEX); SCROLLBAR_SetDefaultSkin (SCROLLBAR_SKIN_FLEX); SLIDER_SetDefaultSkin (SLIDER_SKIN_FLEX); HEADER_SetDefaultSkin (HEADER_SKIN_FLEX); GUI_SetTextMode (GUI_TM_TRANS); #if GUIDEMO_USE_VNC GUI_VNC_X_StartServer(0, 0); #endif #if AUTO_BK // Commented out as hardware is not fast enough to draw gradient background. Can be used on faster targets like ARM9 // // Determine if HW has enough memory to draw the gradient circle as background // BitsPerPixel = LCD_GetBitsPerPixel(); if (BitsPerPixel >= 16) { NumFreeBytes = GUI_ALLOC_GetNumFreeBytes(); if (NumFreeBytes > NUMBYTES_NEEDED) { _pfDrawBk = _DrawBkCircle; } else { _pfDrawBk = _DrawBk; } } else { _pfDrawBk = _DrawBkSimple; } #else _pfDrawBk = _DrawBkSimple; #endif _Main(); }
/** * @brief Start task * @param argument: pointer that is passed to the thread function as start argument. * @retval None */ static void GUIThread(void const * argument) { /* Initialize Storage Units */ k_StorageInit(); /* Demo Startup */ k_StartUp(); /* Show the main menu */ k_InitMenu(); /* Gui background Task */ while(1) { GUI_Exec(); /* Do the background work ... Update windows etc.) */ osDelay(10); /* Nothing left to do for the moment ... Idle processing */ GUI_FreeMem = GUI_ALLOC_GetNumFreeBytes(); } }
/********************************************************************* * * MainTask */ void MainTask(void) { MYWIDGET_Handle hMyWidget; char acExtraBytes[] = "Extrabytes"; GUI_Init(); // // Check if recommended memory for the sample is available // if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { GUI_ErrorOut("Not enough memory available."); return; } hMyWidget = MYWIDGET_Create(10, 10, 100, 50, WM_HBKWIN, WM_CF_SHOW, NULL, _cbMyWidget, strlen(acExtraBytes)); MYWIDGET_SetUserData(hMyWidget, acExtraBytes, strlen(acExtraBytes)); BUTTON_Create(10, 100, 100, 50, 0, WM_CF_SHOW); while (1) { GUI_Delay(100); } }
/********************************************************************* * * MainTask */ void MainTask(void) { GUI_Init(); // // Check if recommended memory for the sample is available // if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { GUI_ErrorOut("Not enough memory available."); return; } #if GUI_SUPPORT_MEMDEV WM_SetCreateFlags(WM_CF_MEMDEV); #endif GUI_CURSOR_Show(); WM_SetCallback(WM_HBKWIN, _cbBkWin); while(1) { _DemoMultiedit(); *_acInfoText = 0; WM_InvalidateWindow(WM_HBKWIN); GUI_Delay(SPEED); } }
void MainTask(void) { WM_HWIN hWin; GUI_Init(); // // Check if recommended memory for the sample is available // if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { GUI_ErrorOut("Not enough memory available."); return; } GUI_CURSOR_Show(); WM_SetCreateFlags(WM_CF_MEMDEV); WM_EnableMemdev(WM_HBKWIN); WM_SetCallback(WM_HBKWIN, &_cbBkWindow); while (1) { hWin = GUI_CreateDialogBox(_aDialogOrder, GUI_COUNTOF(_aDialogOrder), &_cbDialogOrder, WM_HBKWIN, 0, 0); WM_MakeModal(hWin); GUI_ExecCreatedDialog(hWin); GUI_Delay(1500); } }
/********************************************************************* * * MainTask */ void MainTask(void) { GUI_Init(); // // Check if recommended memory for the sample is available // if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { GUI_ErrorOut("Not enough memory available."); return; } #if GUI_SUPPORT_MEMDEV WM_SetCreateFlags(WM_CF_MEMDEV); #endif FRAMEWIN_SetDefaultSkin(FRAMEWIN_SKIN_FLEX); BUTTON_SetDefaultSkin(BUTTON_SKIN_FLEX); RADIO_SetDefaultSkin(RADIO_SKIN_FLEX); CHECKBOX_SetDefaultSkin(CHECKBOX_SKIN_FLEX); HEADER_SetDefaultSkin(HEADER_SKIN_FLEX); GUI_CURSOR_Show(); WM_SetCallback(WM_HBKWIN, _cbBkWin); while (1) { GUI_ExecDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, 0, 0, 0); GUI_Delay(1000); } }
/********************************************************************* * * GUIDEMO_Main */ void GUIDEMO_Main(void) { FRAMEWIN_SKINFLEX_PROPS Framewin_Props; #if GUIDEMO_USE_AUTO_BK int NumFreeBytes; int BitsPerPixel; #endif /*设置在处理动画时要调用的的处理函数,决定终止或继续动画,——cbEffect,用户定义的回调函数*/ GUI_MEMDEV_SetAnimationCallback(_cbEffect, (void *)&_Pressed); /*设置窗口的回调例程*/ WM_SetCallback(WM_HBKWIN, _cbBk); /*将所有按钮设置对水平做出反应*/ BUTTON_SetReactOnLevel(); /*返回framewin皮肤属性*/ FRAMEWIN_GetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_ACTIVE);/*FRAMEWIN_SKINFLEX_PI_ACTIVE活动状态的属性*/ Framewin_Props.Radius = 0; FRAMEWIN_SetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_ACTIVE); FRAMEWIN_GetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_INACTIVE);/*FRAMEWIN_SKINFLEX_PI_INACTIVE非活动状态的属性*/ Framewin_Props.Radius = 0; FRAMEWIN_SetSkinFlexProps(&Framewin_Props, FRAMEWIN_SKINFLEX_PI_INACTIVE); /*设置新创建窗口小工具的皮肤*/ FRAMEWIN_SetDefaultSkin (_FRAMEWIN_DrawSkinFlex/*FRAMEWIN_SKIN_FLEX的换肤回调函数*/); /*设置新创建的PROGBAR小工具的皮肤****/ PROGBAR_SetDefaultSkin (PROGBAR_SKIN_FLEX); /*设置新创建的 BUTTON 小工具的皮肤****/ BUTTON_SetDefaultSkin (BUTTON_SKIN_FLEX); /*设置新创建的 SCROLLBAR滑块 小工具的皮肤****/ SCROLLBAR_SetDefaultSkin (SCROLLBAR_SKIN_FLEX); /*设置新创建的 滑块 小工具的皮肤****/ SLIDER_SetDefaultSkin (SLIDER_SKIN_FLEX); /*设置新创建的 heder 小工具的皮肤****/ HEADER_SetDefaultSkin (HEADER_SKIN_FLEX); /* 设置文本绘制模式 */ GUI_SetTextMode (GUI_TM_TRANS); #if GUIDEMO_USE_VNC if (GUIDEMO_GetConfFlag(GUIDEMO_CF_USE_VNC)) { _GUIDemoConfig.pGUI_VNC_X_StartServer(0, 0); } #endif #if GUIDEMO_USE_AUTO_BK // // Determine if HW has enough memory to draw the gradient circle as background // BitsPerPixel = LCD_GetBitsPerPixel(); if ((BitsPerPixel >= 16) && GUIDEMO_GetConfFlag(GUIDEMO_CF_USE_AUTO_BK)) { NumFreeBytes = GUI_ALLOC_GetNumFreeBytes(); if (NumFreeBytes > NUMBYTES_NEEDED) { _pfDrawBk = _DrawBkCircle; } else { _pfDrawBk = _DrawBk; } } else #endif { _pfDrawBk = _DrawBkSimple; } GUIDEMO_SetDrawLogo(1); while (1) { _Main(); } }
/********************************************************************* * * MainTask */ void MainTask(void) { TREEVIEW_ITEM_Handle hNode; WM_HWIN hTree; int xSize; int ySize; int yPos; int r; int TimeStart; int TimeUsed; int ySizeText; U32 BytesFree; U32 BytesUsed; char acBuffer[(TREEVIEW_DEPTH << 1) + 1]; char acNumNodes[30] = "Nodes: "; char acNumLeaves[30] = "Leaves: "; char acNumTotal[30] = "Total: "; char acTimeUsed[30] = "Time: "; char acBytesUsed[30] = "Memory: "; // // Initialize emWin // WM_SetCreateFlags(WM_CF_MEMDEV); GUI_Init(); xSize = LCD_GetXSize(); ySize = LCD_GetYSize(); // // Set defaults for background and widgets // WM_SetDesktopColor(GUI_BLACK); SCROLLBAR_SetDefaultSkin(SCROLLBAR_SKIN_FLEX); SCROLLBAR_SetDefaultWidth(20); SCROLLBAR_SetThumbSizeMin(25); TEXT_SetDefaultFont(GUI_FONT_6X8); // // Draw info message before creating the widgets // GUI_DrawGradientV(0, 0, xSize - 1, ySize - 1, GUI_BLUE, GUI_BLACK); GUI_SetFont(GUI_FONT_20F_ASCII); GUI_DispStringHCenterAt("Filling TREEVIEW widget...", xSize >> 1, ySize / 3); GUI_X_Delay(1000); // // Create TREEVIEW // hTree = TREEVIEW_CreateEx(0, 0, xSize, ySize, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_TREEVIEW0); TREEVIEW_SetAutoScrollV(hTree, 1);//管理自动使用垂直滚动条。 TREEVIEW_SetSelMode(hTree, TREEVIEW_SELMODE_ROW); // // Fill TREEVIEW // hNode = TREEVIEW_InsertItem(hTree, TREEVIEW_ITEM_TYPE_NODE, 0, 0, "Tree"); BytesFree = GUI_ALLOC_GetNumFreeBytes(); TimeStart = GUI_GetTime(); r = _FillNode(hTree, hNode, NUM_CHILD_NODES, NUM_CHILD_ITEMS, TREEVIEW_DEPTH, TREEVIEW_DEPTH, acBuffer, acBuffer); TimeUsed = GUI_GetTime() - TimeStart; BytesUsed = BytesFree - GUI_ALLOC_GetNumFreeBytes(); if (r) { // // Error message // WM_DeleteWindow(hTree); GUI_MessageBox("Error", "Not enough memory available!", 0); } else { // // Show result // yPos = 20; ySizeText = GUI_GetYDistOfFont( TEXT_GetDefaultFont()) + 5; _MakeNumberText(hTree, xSize >> 1, &yPos, xSize >> 1, ySizeText, acNumNodes, _NumNodes); _MakeNumberText(hTree, xSize >> 1, &yPos, xSize >> 1, ySizeText, acNumLeaves, _NumLeaves); _MakeNumberText(hTree, xSize >> 1, &yPos, xSize >> 1, ySizeText, acNumTotal, _NumNodes + _NumLeaves); _MakeNumberText(hTree, xSize >> 1, &yPos, xSize >> 1, ySizeText, acTimeUsed, TimeUsed); _MakeNumberText(hTree, xSize >> 1, &yPos, xSize >> 1, ySizeText, acBytesUsed, BytesUsed); WM_SetFocus(hTree); } while (1) { GUI_Delay(100); } }