Difference between revisions of "LavishGUI:lguielement (Data Type)"

From Lavish Software Wiki
Jump to navigation Jump to search
 
Line 13: Line 13:
 
* [[DataType:bool|bool]] '''Visible''': True if the element is visible
 
* [[DataType:bool|bool]] '''Visible''': True if the element is visible
 
* [[DataType:bool|bool]] '''AlwaysOnTop''': True if the element is "always on top"
 
* [[DataType:bool|bool]] '''AlwaysOnTop''': True if the element is "always on top"
 +
* [[DataType:int|int]] '''Strata''': The Element's Strata level (-128 to 127), which indicates where the element should remain in the Z order. 127 Strata is the same as AlwaysOnTop
 
* [[DataType:bool|bool]] '''MouseOver''': True if the element has mouse focus
 
* [[DataType:bool|bool]] '''MouseOver''': True if the element has mouse focus
 
* [[DataType:bool|bool]] '''Focus''': True of the element has keyboard focus
 
* [[DataType:bool|bool]] '''Focus''': True of the element has keyboard focus
Line 49: Line 50:
 
* '''SetFocus''' : sets the keyboard focus to this element (if it can accept it)
 
* '''SetFocus''' : sets the keyboard focus to this element (if it can accept it)
 
* '''SetZOrder['''how''']''': choices are alwaysontop, notalwaysontop, moveup, movedown, movetop, movebottom
 
* '''SetZOrder['''how''']''': choices are alwaysontop, notalwaysontop, moveup, movedown, movetop, movebottom
 +
* '''SetStrata['''#''']''': Sets the element's Strata to # (-128 to 127). Strata indicates where the element will remain in the Z order; Always On Top is the same as Strata 127.
 
* '''Show''' : forces the element visible
 
* '''Show''' : forces the element visible
 
* '''Hide''' : forces the element invisible  
 
* '''Hide''' : forces the element invisible  

Latest revision as of 15:35, 16 May 2016

Description

This data type provides and controls data for LGUI elements.

Members

  • string Name: Name of the element
  • string FullName: Fully-Qualified Name (FQN) 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"
  • int Strata: The Element's Strata level (-128 to 127), which indicates where the element should remain in the Z order. 127 Strata is the same as AlwaysOnTop
  • 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
  • bool LeftClickThru: Status of left click thru
  • bool RightClickThru: Status of right click thru
  • float Alpha: The alpha level set for the element
  • float AbsoluteAlpha: The current alpha level
  • float FadeAlpha: The alpha level set for fade alpha
  • uint FadeDelay: Fade delay in milliseconds
  • uint FadeDuration: Fade duration in milliseconds
  • string FadeState: Will return what state fading is in (NORMAL DELAYING FADING FADED)
  • ... AddChild[type,name,XML] : Adds a child of <type> with <name>. <XML> needs to be the full XML information. Requires Inner Space build 4698 or later.
  • ... AddChild[type,name,XML,skin] : Adds a child of <type> with <name> using <skin>. <XML> needs to be the full XML information. Requires Inner Space build 4698 or later.
  • string GetMetadata[key]: Retrieves metadata for this element with the given key. Requires Inner Space build 4698 or later.

Methods

  • AddChild[type,name,XML] : Adds a child of <type> with <name>. <XML> needs to be the full XML information.
  • AddChild[type,name,XML,skin] : Adds a child of <type> with <name> using <skin>. <XML> needs to be the full XML information. Requires Inner Space build 4698 or later.
  • 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
  • SetStrata[#]: Sets the element's Strata to # (-128 to 127). Strata indicates where the element will remain in the Z order; Always On Top is the same as Strata 127.
  • Show : forces the element visible
  • Hide : forces the element invisible
  • ToggleVisible : toggles visibility
  • Destroy: Destroys the element
  • SetLeftClickThru[bool]: Sets left click thru to TRUE or FALSE
  • SetRightClickThru[bool]: Sets rigt click thru to TRUE or FALSE
  • SetAlpha[#]: Sets the alpha to #
  • SetFadeAlpha[#]: Sets the fade alpha to #
Note on alphas. Element alpha is given as a floating point value, with 0 being transparent and 1 being opaque. Each element will be this number times as opaque as its parent. This means that an element with 0.5 can have a child with an alpha level of 2.0, and the resulting alpha level of the child will be 1.0 (e.g. 0.5*2.0=1.0). This value is carried to all descendants during rendering, so if that same child with the value of 2.0 but calculated alpha of 1.0 had its own child with a value of 0.5, the math would be 1.0*0.5=0.5. Note that any value over 1 is going to appear the same as 1 (they do not get any more opaque). Additionally, a fade effect is available for all elements as well, with automatic fading based on mouse position
  • SetFadeDelay[#]: Sets the fade delay to # in milliseconds(1000 is 1 second). There must be a fade delay for fading to work.
  • SetFadeDuration[value]: Sets the fade duration to # in milliseconds (1000 is 1 second).
  • BeginFade: Begins fading
  • ResetFade: Resets alpha to normal
  • InstantFade: Fades instantly
  • SetMetadata[key,value]: Adds metadata to this element, using the given key and value. The metadata value can later be retrieved with the GetMetadata member by passing the key. Requires Inner Space build 4698 or later.
  • UnsetMetadata[key]: Un-sets the metadata with this key. Requires Inner Space build 4698 or later.

Returns

Same as Name

Examples

Add a Child

  • UIElement[screen]: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[fps@main hud]:ToggleVisibile

This command toggles fps element on and off

Display an elements width and height

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

Display an elements type

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

See if an element is visible

  • echo Visible? ${UIElement[fps@main hud].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[fps@main hud]:SetX[100]
  • UIElement[fps@main hud]:SetY[150]
These commands will move the FPS element to 100,150

Set an element to always on top

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

See Also