Widgets
Samples in this section illustrate the use of the GUI-Related classes.本节中的示例演示了GUI相关的类的使用。
UserInterfaceUserInterface#
Creating a user interface and assigning callbacks via C++ API.创建一个用户界面,并通过С++ API分配回调。
WidgetCallbacksWidgetCallbacks#
Working with widget callbacks via C++ API.通过С++ API处理小部件回调。
WidgetCanvasWidgetCanvas#
Creating a widget canvas via C++ API by using the WidgetCanvas class.通过С++ API使用WidgetCanvas类创建一个小部件画布。
WidgetDialogWidgetDialog#
Creating widget dialog windows and assigning callbacks via C++ API.创建小部件对话框窗口,并通过С++ API分配回调。
WidgetExternWidgetExtern#
Creating a custom widget based on WidgetExternBase via C++ API and exporting it to UngineScript.通过С++ API创建基于WidgetExternBase的自定义小部件,并将其导出为UngineScript。
WidgetLifetimeWidgetLifetime#
The sample demonstrates managing the widget lifetime in three ways: while the world is loaded (LIFETIME_WORLD), while the window containing the widgets is open (LIFETIME_WINDOW), and while the engine is running (LIFETIME_ENGINE).该示例演示了以三种方式管理小部件生命周期:在世界处于加载状态时(LIFETIME_WORLD),在包含小部件的窗口打开时(LIFETIME_WINDOW),以及在引擎运行时(LIFETIME_ENGINE)。
The main window named World Lifetime Widgets contains widgets with LIFETIME_WORLD — these widgets are deleted as the world is closed or reloaded. The console will display the corresponding callback messages (world hbox hierarchy removed, world user interface group removed, world button removed).主窗口World Lifetime Widgets包含带有LIFETIME_WORLD的小部件,这些小部件在世界关闭或重新加载时被删除。控制台将显示相应的回调消息(world hbox hierarchy removed, world user interface group removed, world button removed)。
The widgets in the Window Lifetime Widgets window are deleted as soon as this window is closed. This action is also followed by the corresponding console messages.Window Lifetime Widgets窗口中的小部件将在该窗口关闭后立即删除。此操作之后还有相应的控制台消息。
The widgets in the Engine Lifetime Widgets window are only deleted on the engine shutdown. The corresponding callback messages can be seen in the log.txt file.Engine Lifetime Widgets 窗口中的小部件仅在引擎关闭时删除。相应的回调消息可以在log.txt文件中看到。
Manual managing (LIFETIME_MANUAL) of the widget lifetime is not illustrated in this sample.本示例中没有说明使用LIFETIME_MANUAL管理小部件生命周期。
WidgetWindowWidgetWindow#
Creating a widget window and assigning callbacks on edit line and button press events.创建一个小部件窗口并在 行编辑 和 按钮按下 事件上分配回调。