TreeView

The treeview widget displays a hierarchical collection of items. Each item has a textual label, an optional image, and an optional list of data values.

There are two varieties of columns. The first is the main tree view column that is present all the time. The second are data columns that can be added when needed.

Each tree item has a list of tags, which can be used to associate event bindings and control their appearance. Treeview widgets support horizontal and vertical scrolling with the standard scroll commands.

Constructors

this
this(UiElement parent)

Construct the widget.

Members

Functions

addColumn
auto addColumn(TreeViewColumn column)

Add a new column to the tree view.

addRow
auto addRow(TreeViewRow row)

Add a row to the tree view.

addRows
auto addRows(TreeViewRow[] rows)

Add an array of rowr to the tree view.

deleteRows
auto deleteRows()

Delete all rows in the widget.

displayAllDataColumns
auto displayAllDataColumns()

Show all data columns in the event some or all are hidden.

displayDataColumns
auto displayDataColumns(int[] indexes)

Show the data columns that relate to the indexes passed.

getSelectedRows
TreeViewRow[] getSelectedRows(bool includeChildren)

Get the row(s) selected in the tree view.

hideHeadings
auto hideHeadings()

Hide the headings from all columns.

hideTreeColumn
auto hideTreeColumn()

Hide the tree view column.

removeHeadingCommand
auto removeHeadingCommand()

Convenience method to remove the tree view column command.

setHeading
auto setHeading(string title, string anchor)

Convenience method to set the tree column heading text.

setHeadingCommand
auto setHeadingCommand(CommandCallback callback)

Convenience method to set the tree column command to be executed when clicking on the heading.

setHeadingImage
auto setHeadingImage(Image image)

Convenience method to set the tree column heading image.

setMinWidth
auto setMinWidth(int minWidth)

Convenience method to set the minium width of the tree column.

setSelectionMode
auto setSelectionMode(string mode)

Set the selection mode.

setStretch
auto setStretch(bool stretch)

Convenience method to enable or disable stretching for the tree column. This controls how this column react when other columns or the parent widget is resized.

setTag
auto setTag(string name, Image image, string foreground, string background)

Set image and colors for a specific tag. Use colors from the preset color list or a web style hex color.

setWidth
auto setWidth(int width)

Convenience method to set the width of the tree column.

showHeadings
auto showHeadings()

Show the headings for all columns.

showTreeColumn
auto showTreeColumn()

Show the tree view column.

updateDataColumn
auto updateDataColumn(string rowId, uint columnIndex, string value)

Set the value of a data column, given a row id. Row id's are populated within a tree view row object once that row has been inserted into the tree view.

Mixins

__anonymous
mixin Height

Mixin common commands.

__anonymous
mixin Padding
Undocumented in source.
__anonymous
mixin XScrollCommand!(TreeView)
Undocumented in source.
__anonymous
mixin YScrollCommand!(TreeView)
Undocumented in source.

Properties

columns
TreeViewColumn[] columns [@property getter]

Get the columns.

Mixed In Members

From mixin Height

setHeight
auto setHeight(int height)

Set the height of the widget if the geometry manager allows.

From mixin Padding

setPadding
auto setPadding(int padding)

Set the amount of padding within the widget.

Inherited Members

From Widget

setState
auto setState(string[] state)

Set the widget's state.

getState
string[] getState()

Get the widget's state.

inState
bool inState(string[] state)

Test if a widget is in a particular state.

removeState
auto removeState(string[] state)

Remove the widget's state.

resetState
auto resetState()

Reset the widget's state to default.

setStyle
auto setStyle(string style)

Set the widget's style.

getStyle
string getStyle()

Get the widget's style.

setKeyboardFocus
auto setKeyboardFocus(string focus)

Set if the widget can recieve focus during keyboard traversal.

getKeyboardFocus
string getKeyboardFocus()

Get if the widget can recieve focus during keyboard traversal.

pack
auto pack(int outerPadding, int innerPadding, string side, string fill, string anchor, bool expand)

Geometry method for loosely placing this widget inside its parent using a web browser model. Widgets flow around each other in the available space.

grid
auto grid(int column, int row, int outerPadding, int innerPadding, int columnSpan, int rowSpan, string sticky)

Geometry method for placing this widget inside its parent using an imaginary grid. Somewhat more direct and intuitive than pack. Choose grid for tabular layouts, and when there's no good reason to choose something else.

place
auto place(int xPos, int yPos, int width, int height, string anchor, string borderMode)

Geometry method for placing this widget inside its parent using absolute positioning.

place
auto place(double relativeXPos, double relativeYPos, double relativeWidth, double relativeHeight, string anchor, string borderMode)

Geometry method for placing this widget inside its parent using relative positioning. In this case the position and size is specified as a floating-point number between 0.0 and 1.0 relative to the height of the parent. 0.5 means the widget will be half as high as the parent and 1.0 means the widget will have the same height as the parent, and so on.

Examples

auto treeView = new TreeView()
	.setHeading("Text")
	.addRow(new TreeViewRow(["row1"]))
	.addRow(new TreeViewRow(["row2"]))
	.pack();

Common Commands

These are injected common commands that can also be used with this widget.

Height
Padding
XScrollCommand
YScrollCommand

Additional Events

Additional events that can also be bound to using the bind method.

<<PrevWindow>>, <<TreeviewClose>> <<TreeviewOpen>> <<TreeviewSelect>> <Alt-Key>, <B1-Leave>, <B1-Motion>, <Button-1>, <Button-4>, <Button-5>, <ButtonRelease-1>, <Control-Button-1>, <Double-Button-1>, <Key-Down>, <Key-F10>, <Key-Left>, <Key-Next>, <Key-Prior>, <Key-Return>, <Key-Right>, <Key-Tab>, <Key-Up>, <Key-space>, <Leave>, <Motion>, <Shift-Button-1>, <Shift-Button-4>, <Shift-Button-5>,

See Also

Meta