Widget

This is the most fundamental of all widgets, and used in every other widget. It yields core functions, focus and child systems, and an entity for the uianim component.

Widget Fields

TypeNameDescription
tablechildrenAll widgets added to this one as a child are referenced here.
tablecallbacksholds a list of callbacks, not really used externally
instinstan entity for the uianim component, positioning and other stuff
booleanenabledwhether the widget is enabled, you can break the focus flow using this
booleanshownWhether the widget is visible
booleanfocuswhether the mouse hovers over this widget
booleanfocus_targetwhether this widget is the absolute target of the mouse
tablefocus_flownot really used externally
tablefocus_flow_argsnot really used externally
widgetparentthe parent widget, if available

Widget Methods

NameParameterReturnsDescription
MoveToBack, MoveToFrontnilnilchange the z-layer, probably absolute?
OnFocusMovedir, downbooleannot to be used externally
OnMouseButtonbutton, down, x, ynilOverriding this could be fun. per default passed on to children
OnRawKeykey, downnilOverriding this could be fun. per default passed on to children
OnTextInputtextnilOverriding this could be fun when using the textedit widget. per default passed on to children
OnControlcontrol, downnilOverriding this could be fun. per default passed on to children
GetScalenilVector3considers the parents scale
SetScalevector3 or x,y,znilallows to set a different scale manually
ScaleTofrom, to, time, cbfnnilmathematical stuff in a compact function
SetScaleModemodenilallows to set a different scale based on the monitor
MoveTofrom, to, time, fnnilmathematical stuff in a compact function
SetPositionvector3 or x,y,znilsets the position (try using anchors instead)
SetRotationanglenilsets the rotation
SetVAnchor, SetHAnchoranchornilsets the position using an anchor
Nudgeoffsetnilallows setting the position with offsets
GetParent, GetChildrennilwidget/tablesimply returns the fields
IsEnablednilbooleanwhether the widget and its parent are enabled
Enablenilnilper default doesn't do anything exciting at all
Disablenilnilper default doesn't do anything exciting at all
AddChildchildchildadds the given widget as a child
RemoveChildchildnilThis does not kill the child.
KillAllChildrennilnilremoves all child widgets
Killnilnilremoves the widget and all children
IsVisiblenilbooleanwhether the widget and its parent are visible
HidenilnilMakes the widget invisible
ShownilnilMakes the widget visible
GetPosition, GetLocalPositionnilVector3return the same value
GetWorldPositionnilVector3returns the world position
SetMaxPropUpscalevalnilunknown functionality
HookCallbackevent, cbfnnillistens for that event
SetTooltipstringnilallows to set a text that isn't even used by the default widget
SetTooltipColourr,g,b,anilsets the text colour
GetTooltipColourniltable{r,g,b,a}also checks children
GetTooltipnilstringalso checks children
StartUpdating, StopUpdatingnilnilPeriodically fires a "OnUpdate" function when updating
SetClickablebooleannilwhether the widget is clickable
FollowMouse, StopFollowMousenilnilThe widget always sets its position to the mouse position. This is used for moving items, etc.
ClearFocusDirsnilnilsets focus_flows to an empty table
SetFocusChangeDirdir, widget, ...niladds a focus flow
IsDeepestFocusnilbooleanNote that this doesn't imply being focused at all, it only checks the children for being focused.
GetDeepestFocusnilwidgetreturns the last child that has focus or self
ClearFocusnilniltells the widget and its children to stop being focused
SetFocusFromChildchildnildisables focus from all other childs
SetFocusnilnilsets the main focus to this widget
OnEnable, OnDisable, OnShow, OnHide,OnGainFocus, OnLoseFocusnilnilThese are to be overriden.

explanation of usual stuff to come