# 第二部分第十五章 不可见控件 # Chapter 15 of Part 2 Invisible Control ## 不可见控件简介 ## Brief Introduction of Invisible Control 不可见控件是指那些不能在窗口上显示,但是却具有一定功能的组件。 Invisible control refers to the components which cannot be displayed on the window but have certain functions. 这些组件是对一些功能模块的封装,保证它们能够像控件一样在miniStudio中被编辑 These components is encapsulation to some functional templates, guaranteeing that they can be edited in miniStudio like control - mObject - mComponent * `mInvsbComp` ## `mInvsbComp` - *控件名称*: 无 - *英文名*: Invisble Component - *简要介绍*: 不可见组件的基类 - *示意图*: %RED%基础类,不能直接使用%ENDCOLOR% - *Control name*: None - *English name*: Invisble Component - *Brief introduction*: Basic class of invisible component - *Schematic diagram*: %RED%Foundation class, cannot be used directly%ENDCOLOR% ### `mInvsbComp风格` ### Style of `mInvsbComp` 继承自mComponent的风格 It is inherited from the style of `mComponent` ### `mInvsbComp属性` ### Property of `mInvsbComp` 继承自mComponent的属性 It is inherited from the property of `mComponent` ### `mInvsbComp方法` ### Method of `mInvsbComp` `mInvsbComp提供了以下方法的实现:` `mInvsbComp` provides realization of the following methods: - `setId` - `getId` - `setReleated` - `getReleated` - `getChild` 另外,为方便mInvsbComp的使用,提供了如下函数 In addition, for the convenience of use of `mInvsbComp,` the following functions are provided - 创建不可见组件 - Create invisible component %CODE{cpp}% /** * \fn `mInvsbComp` * `ncsCreateInvsbComp(const` char* `class_name,` \ `mComponent*` parent, \ int id, `NCS_PROP_ENTRY` *props, \ `NCS_EVENT_HANDLER` * handlers, \ `DWORD` `user_data);` * \brief create an Invisible Component * * \param `class_name` the class name of Invisible Component * \param parent the parent of creating Invisible Component * \param id the id of Invisible Component * \param props the properties array of Invisible Component * \param handlers the event handler array of Invisible Component * \param `user_data` user data * * \return `mInvsbComp` * - the new created Invisible Component pointer, `NULL` or failed * * \sa `NCS_INVSB_CREATE_INFO`, `ncsCreateInvsbCompIndirect` */ `mInvsbComp` * `ncsCreateInvsbComp(const` char* `class_name,` \ `mComponent*` parent, \ int id, \ `NCS_PROP_ENTRY` *props, \ `NCS_EVENT_HANDLER` * handlers, \ `DWORD` `user_data);` /** * \fn `mInvsbComp` * `ncsCreateInvsbCompIndirect(const` char* `class_name,` \ `NCS_INVSB_CREATE_INFO` *create_info); * \brief create an Invisible Component from creating info * * \param `class_name` the class name of Invisible Component * \param `create_info` the creating information pointer * * \return `mInvsbComp` * - the Invisible Component pointer if success, `NULL` or failed * * \sa `NCS_INVSB_CREATE_INFO`, `ncsCreateInvsbComp` */ `mInvsbComp` * `ncsCreateInvsbCompIndirect(const` char* `class_name,` \ `NCS_INVSB_CREATE_INFO` *create_info); ``` ``` - 注: *不鼓励直接使用该函数创建不可见组件* ,它们在手写代码中没有优势,优势在于,可以利用miniStudio提供的资源来加载。 故省略例子 - Note: * it is not encouraged to directly use the function to create invisible component, * and they have no advantage in handwritten codes. The advantage is that resources provided by miniStudio can be utilized to load. 故省略例子 So example is omitted. ### `mInvsbComp事件` ### Event of `mInvsbComp` 继承自mComponent的事件 It is inherited from the event of `mComponent` ## `mTimer` - *控件名称*: `NCSCTRL_TIMER` - *英文名*: Timer - *简要介绍*: 对MiniGUI `SetTimerEx和KillTimer的封装` ![alt](figures/mtimer.png) - *Control name*: `NCSCTRL_TIMER` - *English name*: Timer - *Brief introduction*: Encapsulation to MiniGUI `SetTimerEx` and `KillTimer` ![alt](figures/mtimer.png) 继承关系 Inheritance relation - mObject - mComponent * mInvsbComp * `mTimer` ### `mTimer风格` ### Style of `mTimer` 继承自mInvsbComp的风格 It is inherited from the` style of `mInvsbComp` ### `mTimer属性` ### Property of `mTimer` 继承自mInvsbComp的属性 | * 属性ID *| *miniStudio 名*| *类型* | *权限* |* 说明 *| | `NCSP_TIMER_INTERVAL` | interval | `DWORD` | `RW` | 设置Timer的时间间隔,以10ms为单位, 如果Timer正在运行,它会重启Timer | It is inherited from ` the property of `mInvsbComp` | * Property `ID` *| *miniStudio name*| *Type* | *Authority* |* Explanation *| | `NCSP_TIMER_INTERVAL` | interval | `DWORD` | `RW` | Set time interval of Timer, with 10ms as the unit. If Timer is operating, it will restart Timer | ### `mTimer方法` ### Method of `mTimer` 继承自mInvsbComp的方法 It is inherited from the` method of `mInvsbComp` - start %CODE{cpp}% `BOOL` (*start)(clss *_this); ``` ``` - 停止正在运行的Timer - Stop the Timer in operation - `getParent` %CODE{cpp}% `HWND` (*getParent)(clss *_this); ``` ``` - Return : `TRUE` -- continue Timer, `FALSE` -- stop Timer - Params * `DWORD` `total_count` - Timer启动以来总时间数 - Return : `TRUE` -- continue Timer, `FALSE` -- stop Timer - Params * `DWORD` `total_count` - Total time amount since Timer starts ### `mTimer示例` ### Example of `mTimer` 下面示例展示的是用timer显示一个数字钟表,运行效果图如下:
The example below demonstrates using timer to show a digital clock, and the operation effect drawing is as below:
![alt](figures/timer-show.png) - 声明Timer,使用和控件一样的结构 - Declare Timer uses the same structure as the control %CODE{cpp}% %INCLUDE{"%ATTACHURL%/timer.c.txt" pattern="^.*?//START_DECLARE_TIMER(.*?)//END_DECLARE_TIMER.*"}% ``` ``` - 当MSG_TIMER事件发生时,更新时间 - When `MSG_TIMER` event occurs, update the time %CODE{cpp}% %INCLUDE{"%ATTACHURL%/timer.c.txt" pattern="^.*?//START_UPDATE_TIME(.*?)//END_UPDATE_TIME.*"}% ---- [<< ](MiniGUIProgGuidePart.md) | [Table of Contents](README.md) | [ >>](MiniGUIProgGuidePart.md) [Release Notes for MiniGUI 3.2]: /supplementary-docs/Release-Notes-for-MiniGUI-3.2.md [Release Notes for MiniGUI 4.0]: /supplementary-docs/Release-Notes-for-MiniGUI-4.0.md [Showing Text in Complex or Mixed Scripts]: /supplementary-docs/Showing-Text-in-Complex-or-Mixed-Scripts.md [Supporting and Using Extra Input Messages]: /supplementary-docs/Supporting-and-Using-Extra-Input-Messages.md [Using CommLCD NEWGAL Engine and Comm IAL Engine]: /supplementary-docs/Using-CommLCD-NEWGAL-Engine-and-Comm-IAL-Engine.md [Using Enhanced Font Interfaces]: /supplementary-docs/Using-Enhanced-Font-Interfaces.md [Using Images and Fonts on System without File System]: /supplementary-docs/Using-Images-and-Fonts-on-System-without-File-System.md [Using SyncUpdateDC to Reduce Screen Flicker]: /supplementary-docs/Using-SyncUpdateDC-to-Reduce-Screen-Flicker.md [Writing DRI Engine Driver for Your GPU]: /supplementary-docs/Writing-DRI-Engine-Driver-for-Your-GPU.md [Writing MiniGUI Apps for 64-bit Platforms]: /supplementary-docs/Writing-MiniGUI-Apps-for-64-bit-Platforms.md [Quick Start]: /user-manual/MiniGUIUserManualQuickStart.md [Building MiniGUI]: /user-manual/MiniGUIUserManualBuildingMiniGUI.md [Compile-time Configuration]: /user-manual/MiniGUIUserManualCompiletimeConfiguration.md [Runtime Configuration]: /user-manual/MiniGUIUserManualRuntimeConfiguration.md [Tools]: /user-manual/MiniGUIUserManualTools.md [Feature List]: /user-manual/MiniGUIUserManualFeatureList.md [MiniGUI Overview]: /MiniGUI-Overview.md [MiniGUI User Manual]: /user-manual/README.md [MiniGUI Programming Guide]: /programming-guide/README.md [MiniGUI Porting Guide]: /porting-guide/README.md [MiniGUI Supplementary Documents]: /supplementary-docs/README.md [MiniGUI API Reference Manuals]: /api-reference/README.md [MiniGUI Official Website]: http://www.minigui.com [Beijing FMSoft Technologies Co., Ltd.]: https://www.fmsoft.cn [FMSoft Technologies]: https://www.fmsoft.cn [HarfBuzz]: https://www.freedesktop.org/wiki/Software/HarfBuzz/