LavishGUI:tree (Element Type)

From Lavish Software Wiki
Jump to navigation Jump to search

Introduction

What is a Tree?

A tree shows a hierarchy of nodes, with text and/or images. lguitree is used to provide access via LavishScript.

Using Trees

Trees are descendants of the frame element type. Any attributes of the frame element type may be applied in addition to the slider-specific properties described below.

Tree-Specific Properties

  • IndentPerDepth: When displaying a node, it will be indented by this many pixels on the left, per parent node
  • ImageSize: Size of image in pixels, to be used as both the height and width of the image for each node
  • ImageBorder: Size of image border in pixels
  • TextMargin: The number of pixels between the image for a node, and the text
  • ItemHeight: The number of pixels to use for item height, which should generally be greater than or equal to the image and font sizes.
  • SelectionBackgroundColor: Background color to be used for the currently-selected item
  • SelectionTextColor: Text color to be used for the currently-selected item
  • ImageTexture: Texture to be used by default for each non-collapsible item
  • ImageTextureCollapsible: Texture to be used by default for each collapsible item
  • ImageTextureCollapsed: Texture to be used by default for each collapsed item
  • ScrollBar: Scrollbar (assumes vertical with placement on the right) to be used for the tree

Embedded Script

  • OnDeselect
Executes when the currently-selected node is being de-selected (in other words, this will execute while it is still lguitree.Selection)
  • OnSelect
Executes when the currently-selected node has changed (in other words, this executes after lguitree.Selection has been updated with the new selection)

Examples

   <Tree Name="my tree">
   <Height>100</Height>
   <Width>200</Width>
   <Border>1</Border>
   <BorderColor>FFFFFFFF</BorderColor>
   <BackgroundColor>FF000000</BackgroundColor>
   <SelectionBackgroundColor>FF000066</SelectionBackgroundColor>
   <SelectionTextColor>FFFFFFFF</SelectionTextColor>
   <ImageSize>12</ImageSize>
   <ItemHeight>14</ItemHeight>
   <ImageBorder>2</ImageBorder>
   <TextMargin>5</TextMargin>
   <IndentPerDepth>21</IndentPerDepth>
   <ScrollBar template='tree.scrollbar' />
   
   <ImageTexture template='checkbox.Texture' />
   <ImageTextureCollapsible template='checkbox.TextureChecked' />
   <ImageTextureCollapsed template='checkbox.TextureHover' />
   <OnLoad><![CDATA[
   variable int MyParent
   MyParent:Set[${This.Root.AddChild["Something in red",ffff0000]}]
   This.GetNode[${MyParent}]:SetMetadata["author","lax"]:AddChild["Something in the color specified by Font"]
   This.GetNode[${MyParent}].Children:Select
   This.Root:AddChild["Something else"]
   ]]></OnLoad>
   </Tree>

See Also