Maptitude GISDK Help |
A tree view is a sub-window of the dialog box in which the user views and selects from a list of folders. If there are more folders than fit in the window, the tree view displays a scroll bar that allows the user to view them all. The format of a tree view item definition is:
Tree View {"item name"} hpos, vpos {, width {, height}} {options} {do
<statements go here>
endItem}
If the do ... endItem section of the tree view definition is included, the statements are executed whenever the user changes the selection in the tree view (see the Variables option below). The statements are not executed when the user views items using the scroll bar. If the width is not specified, the tree view is twenty characters wide. If the height is not specified, the tree view is four lines high.
Tree View Options |
Description |
Key: hotkey |
The key sequence the user can press to move the keyboard focus to the tree view item instead of using the mouse. The hotkey has the format alt_character, where character must be a letter or number. For example, Key: alt_A indicates that holding the Alt key and pressing A activates the item. The specified key is underlined in the item's text. A hotkey only works if the key in question is part of the item's text and is case insensitive. |
Disabled |
The tree view is initially disabled. |
Hidden |
The tree view is initially hidden. |
Help: help_specs |
Help information displayed in a popup window and the status bar. Help strings can be string expressions. |
Menu: array |
Provides a context-sensitive menu when the user right-clicks on an item in the control. The value of the menu options is an array, each of whose elements corresponds to an item in the menu to be displayed and which is itself an options array; for more information, see Dialog Box Items. |
Prompt: expression |
The text that appears to the left of the scroll list. If omitted, there is no text next to the scroll list. |
List: array |
An array describing the tree. Each element of the array is a node description. Each node description is an array {label, children} where label is the string for this element of the tree, and children is an array of node descriptions of child nodes. If the node is a leaf, children can be null or a value that you can use. |
Variables: variables |
One, two, or three variables. The first variable is an array of indices which describes the selected item. {1,2,3} means the third element of the second element of the first top-level tree element is the selected one. The second variable is set to 1 if the user clicked to expand/collapse an item, 0 otherwise. The third variable is an array of open/close states of the tree structure. This array has the same dimensions as the input array, but instead of labels it has integers, 1 means the subtree is open, 0 means it is closed. |
For example:
Dbox "Dialog Box with a Tree View"
Init do
name_tree = { { "Female" , {{ "Mary" , "Maria" } ,
{ "Jane" , "Giovanna" }}} ,
{ "Male" , {{"John" , "Giovanni" } ,
{"Albert" , "Alberto" }}}
}
selected_nodes = null
italian_name = null
enditem
Text 1, 1, 30 variable: italian_name
Tree View same, 3, 30, 6 List: name_tree Variable: selected_nodes do
If TypeOf(selected_nodes) = "array" then do
selected_name = "Root"
selected_children = name_tree
for i=1 to selected_nodes.length do
if TypeOf(selected_children) = "array" then do
selected_name = selected_children[selected_nodes[i]][1]
selected_children = selected_children[selected_nodes[i]][2]
end
end
if TypeOf(selected_children) = "string" then italian_name = selected_children
end
enditem
Button 20, after, 10 default prompt: "OK" do
Return()
enditem
endDbox
©2025 Caliper Corporation | www.caliper.com |