LavishGUI:lguielement (Data Type)

From Lavish Software Wiki
Jump to navigation Jump to search

Description

This data type provides and controls data for LGUI elements.

Members

  • string Name: Name of the element
  • int ID: Unique ID number of the element
  • int X: X position relative to its parent
  • int Y: Y position relative to its parent
  • int AbsoluteX: X position relative to the display
  • int AbsoluteY: Y position relative to the display
  • int Width: Width of the element
  • int Height: Height of the element
  • bool Visible: True if the element is visible
  • bool AlwaysOnTop: True if the element is "always on top"
  • bool MouseOver: True if the element has mouse focus
  • bool Focus: True of the element has keyboard focus
  • string Type: Element type (such as "button")
  • ... Parent: Parent element
  • ... Children: First child element (bottom of Z order)
  • ... Next: Next element
  • ... Previous: Previous element
  • ... FindChild[name]: Finds a direct child of this element with the given name
  • ... FindUsableChild[name,type]: Finds a descendant of this element with the given name and element type

Methods

  • AddChild[type,name,XML] : Adds a child of <type> with <name>. <XML> needs to be the full XML information.
  • LeftClick : left clicks on the element
  • LeftMouseDown : holds left mouse button down on the element
  • LeftMouseUp : releases left mouse button
  • RightClick : right clicks on the element
  • RightMouseDown : holds right mouse button down on the element
  • RightMouseUp : releases right mouse button
  • SetX[#] : sets the elements X to #
  • SetY[#] : sets the elements Y to #
  • SetWidth[#] : sets the elements width to #
  • SetHeight[#] : sets the elements height to #
  • SetFocus : sets the keyboard focus to this element (if it can accept it)
  • SetZOrder[how]: choices are alwaysontop, notalwaysontop, moveup, movedown, movetop, movebottom
  • Show : forces the element visible
  • Hide : forces the element invisible
  • ToggleVisible : toggles visibility

Returns

Same as Name

Examples

Add a Child

  • UIElement[${TestXML}]:AddChild[text,test,<Text name='test'><X>15</X><Y>20</Y><Width>100</Width><Height>100</Height><Text>Hello World</Text></Text>]

Get the ID of an element

  • echo Element #: ${UIElement[main hud].ID}
Output
Element #: 2

Toggle an elements visibility

UIElement[main hud].FindChild[fps]:ToggleVisibile

This command toggles fps element on and off

Display an elements width and height

  • echo Width: ${UIElement[main hud].FindChild[fps].Width} Height: ${UIElement[main hud].FindChild[fps].Height}
Output
Width: 20 Height: 12

Display an elements type

  • echo Type: ${UIElement[main hud].FindChild[fps].Type}
Output
Type: hudelement

See if an element is visible

  • echo Visible? ${UIElement[main hud].FindChild[fps].Visible}
Output
Visible? TRUE

Left click an element

  • UIElement[Button Window].FindChild[Exit button]:LeftClick
This command left clicks on the "Exit button" child of "Button Window" window

Move an element to 100,150 location

  • UIElement[main hud].FindChild[fps]:SetX[100]
  • UIElement[main hud].FindChild[fps]:SetY[150]
These commands will move the FPS element to 100,150

Set an element to always on top

  • UIElement[main hud].FindChild[fps]:SetZOrder[alwaysontop]
This command sets element "fps" in "main hud" to AlwaysOnTop

See Also