Creation/Dev/Script/Client/GuiTreeViewCtrl: Difference between revisions

From Graal Bible
mNo edit summary
 
No edit summary
 
(13 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<pre>
[[Category:Scripting Reference]]
      GuiTreeViewCtrl (GuiArrayCtrl):
Inherits [[Creation/Dev/Script/Client/GuiArrayCtrl|GuiArrayCtrl]].
        clipcolumntext - boolean
 
        columns - string - of format "0 16", offset of the tabulators
=Description=
        expanded - boolean
 
        expandedimage - integer
[[Image:Guicontrol_treeview.png]]
        expandedselectedimage - integer
 
        expandondoubleclick - boolean
The TreeView control can display a tree structure similar to the Windows Explorer file view. Each node can have an icon and the text can be divided into several columns by using the columns offset array and tabulators in the node name. The TreeView control must be put into a [[Creation/Dev/Script/Client/GuiScrollCtrl|GuiScrollCtrl]] to work properly.
        fitparentwidth - boolean
 
        groupsortorder - string
=Variables=
        image - integer
 
        level - integer (read only)
{| border="1" cellpadding="2" width="100%"
        name - string
| '''Name'''
        nodes - object (read only)
| '''Type'''
        parent - object (read only)
| '''Description'''
        selectedimage - integer
|-
        sortgroup - integer
| clipcolumntext
        sortmode - string
| boolean
        sortorder - string
|
        sortvalue - integer
|-
        visible - boolean
| columns
        x - integer (read only)
| string
        y - integer (read only)
| Of format "0 16", offset of the tabulators
        addlines(obj, bool)
|-
        addnode(str) - returns object
| expanded
        addnodebypath(str, str) - returns object
| boolean
        addvars(obj, bool)
|
        clearnodes()
|-
        destroy()
| expandedimage
        getfullname(str) - returns string
| integer
        getnode(str) - returns object
|
        getnodeat(int, int) - returns object
|-
        getnodebypath(str, str) - returns object
| expandedselectedimage
        getselectednode() - returns object
| integer
        select()
|
        seticonsize(int, int)
|-
        sort()
| expandondoubleclick
</pre>
| boolean
|
|-
| fitparentwidth
| boolean
|
|-
| groupsortorder
| string
|
|-
| image
| integer
|
|-
| level
| integer (read only)
|
|-
| name
| string
|
|-
| nodes
| object (read only)
| array of [[Creation/Dev/Script/Client/GuiTreeViewNode|GuiTreeViewNode]]
|-
| parent
| object (read only)
|
|-
| selectedimage
| integer
|
|-
| sortgroup
| integer
|
|-
| sortmode
| string
|
|-
| sortorder
| string
|
|-
| sortvalue
| integer
|
|-
| visible
| boolean
|
|-
| x
| integer (read only)
|
|-
| y
| integer (read only)
|
|}
 
=Functions=
 
The GuiTreeViewCtrl works as root node of the tree, that's why many functions from the [[Creation/Dev/Script/Client/GuiTreeViewNode|GuiTreeViewNode]] are also available for this.
 
{| border="1" cellpadding="2" width="100%"
| '''Name'''
| '''Return Type'''
| '''Description'''
|-
| addlines(obj, bool)
|
|
|-
| addnode(str)
| object
|
|-
| addnodebypath(str, str)
| object
|
|-
| addvars(obj, bool)
|
|
|-
| clearnodes()
|
|
|-
| getnode(str)
| object
|
|-
| getnodeat(int, int)
| object
|
|-
| getnodebypath(str, str)
| object
| parameters are the node name and separator character
|-
| getselectednode()
| object
|
|-
| seticonsize(int, int)
|
| sets the width and height of the icons for the entries, maximum size is 64x64
|-
| sort()
|
|
|}
 
=Events=
 
onExpand(node,nodeslashpath,nodedotpath) - a node has been expanded
 
onFold(node,nodeslashpath,nodedotpath) - a node has been folded
 
onSelect(node,nodeslashpath,nodedotpath) - a node has been selected
 
onDblClick(node,nodeslashpath,nodedotpath) - is invoked when the mouse is double-clicked while being over a node
 
onOpenMenu(node,nodeslashpath,nodedotpath) - is invoked when the right mouse button is clicked while the mouse is over a node
 
onIconResized(newwidth,newheight) - the icon size has been modified (via setIconSize())
 
=Example=
 
  new GuiScrollCtrl("Test_TreeScroll") {
    profile = GuiBlueScrollProfile;
    x = 10;
    y = 10;
    width = 160;
    height = 80;
    hScrollBar = "dynamic";
    vScrollBar = "dynamic";
 
    new GuiTreeViewCtrl("Test_Tree") {
      profile = GuiBlueTreeViewProfile;
      x = y = 0;
      width = 140;
      fitparentwidth = true;
     
      clearnodes();
      addnodebypath("Tree/View","/");
      with (addnodebypath("Tree/Control","/")) {
        image = selectedimage = 2;
      }
    }
  }

Latest revision as of 23:57, 15 February 2010

Inherits GuiArrayCtrl.

Description

Guicontrol treeview.png

The TreeView control can display a tree structure similar to the Windows Explorer file view. Each node can have an icon and the text can be divided into several columns by using the columns offset array and tabulators in the node name. The TreeView control must be put into a GuiScrollCtrl to work properly.

Variables

Name Type Description
clipcolumntext boolean
columns string Of format "0 16", offset of the tabulators
expanded boolean
expandedimage integer
expandedselectedimage integer
expandondoubleclick boolean
fitparentwidth boolean
groupsortorder string
image integer
level integer (read only)
name string
nodes object (read only) array of GuiTreeViewNode
parent object (read only)
selectedimage integer
sortgroup integer
sortmode string
sortorder string
sortvalue integer
visible boolean
x integer (read only)
y integer (read only)

Functions

The GuiTreeViewCtrl works as root node of the tree, that's why many functions from the GuiTreeViewNode are also available for this.

Name Return Type Description
addlines(obj, bool)
addnode(str) object
addnodebypath(str, str) object
addvars(obj, bool)
clearnodes()
getnode(str) object
getnodeat(int, int) object
getnodebypath(str, str) object parameters are the node name and separator character
getselectednode() object
seticonsize(int, int) sets the width and height of the icons for the entries, maximum size is 64x64
sort()

Events

onExpand(node,nodeslashpath,nodedotpath) - a node has been expanded

onFold(node,nodeslashpath,nodedotpath) - a node has been folded

onSelect(node,nodeslashpath,nodedotpath) - a node has been selected

onDblClick(node,nodeslashpath,nodedotpath) - is invoked when the mouse is double-clicked while being over a node

onOpenMenu(node,nodeslashpath,nodedotpath) - is invoked when the right mouse button is clicked while the mouse is over a node

onIconResized(newwidth,newheight) - the icon size has been modified (via setIconSize())

Example

 new GuiScrollCtrl("Test_TreeScroll") {
   profile = GuiBlueScrollProfile;
   x = 10;
   y = 10;
   width = 160;
   height = 80;
   hScrollBar = "dynamic";
   vScrollBar = "dynamic";
   new GuiTreeViewCtrl("Test_Tree") {
     profile = GuiBlueTreeViewProfile;
     x = y = 0;
     width = 140;
     fitparentwidth = true;
     
     clearnodes();
     addnodebypath("Tree/View","/");
     with (addnodebypath("Tree/Control","/")) {
       image = selectedimage = 2;
     }
   }
 }