ui Panel

Ui panel

Panel widgets are a great way to group together widgets and save time in controlling multiple widgets. Think of a panel as a windows form, where each ‘child’ widget is linked to the ui_panel widget. Then by just moving the panel, all children will follow. Children will inherit positioning, alpha, zoom, enabled and visible properties.

Add a panel, assign it’s colors or background sprite. Rename the panel instance name to something easy. Then you need to go to each child widget and assign the panel’s instance name to its uiAnchor property.

So if you have a panel instance name called ‘panel_config’. Then we would go to all the child widgets and on the create method we would set uiAnchor=panel_config. Now in code if we were to set panel_config.uiVisible=false, all the children(linked widgets) would be invisible.

This is just one example of how to use the panels, there are many useful ways that they help make life easier. These are properties that you may wish to change for panels.

Property Description

uiBackColor = c_navy; //background color
uiBackColor2 = c_blue; //gradient with uiBackColor
uiPanelSprite = -1; //Panel for Sprite (optional)
uiSpriteIndex=0; //Spriteindex for uiPanelSprite
uiSpriteScale = 1.0; //0=auto-scale sprite to widget dimensions.

You may also like...