CreateGUIWidget||doc136363

September 20, 2022

Format

UI:CreateGUIWidget(widgetType, instanceName)
  • Function class:UI
  • Call restrictions:Client

Describe

Create a single control and return, allowing the creation of any control type. This creates a clean control without any parent-child relationship, which is useful for specific business needs. However, generally, it is recommended that developers or UI designers directly use the interface editor to determine the fate of a single control, which will make the effect of interface rendering more intuitive and easier to adjust.

parameter

Variable name Type Describe
widgetType WidgetType Control type

Return value

Type Describe
Window Control instance, which returns the corresponding control according to the specified type

Code example

Create a picture control, add it as the child of another GUI window instance, and set the control size and picture resources.

local function InitUI()