<<

Contents

Search

>>

 

TREEVIEW

 

 

Function

 

 

Syntax:

TREEVIEW([<WAIT|NOWAIT>, <Exit Macro>, <Split-Windowcall Handle>], <Array>, <Default Value>, <Count>, <Separator>, <Header>, <Height in Rows>, <Width in Columns>, <Element Height in Pixel>, <Expand Level> [,<Edit> [,<Red>, <Green>, <Blue>]])

 

<Exit Macro>

= <MACRONAME>

<Split-Windowcall Handle>

= <NUM-EXPRESSION>

<Array>

= <STRING-VARIABLE>

<Default Value>

= <STRING-EXPRESSION>

<Count>

= <NUM-EXPRESSION>

<Separator>

= <STRING-EXPRESSION>

<Header>

= <STRING-EXPRESSION>

<Height in Rows>

= <NUM-EXPRESSION>

<Width in Columns>

= <NUM-EXPRESSION>

<Element Height in Pixel>

= <NUM-EXPRESSION>

<Expand Level>

= <NUM-EXPRESSION>

<Edit>

= <NUM-EXPRESSION>

<Red>

= <NUM-EXPRESSION>

<Green>

= <NUM-EXPRESSION>

<Blue>

= <NUM-EXPRESSION>

 

 

Meaning:

Creates a Treeview which is displayed in a window.

 

WINDOWPOS defines the position of the TREEVIEW window.

 

TREEVIEW is inserted on the mask like a mask field if the following 2 conditions are fulfilled:

 

1. The parameter NOWAIT is specified.

2. The variable EBUS_CHILDWINDOW is not 0.

 

In this case the TREEVIEW can be called like the other fields by the keys <→|>, <↓>, etc. In the <Exit Macro> the variable EBUS_DATA contains the return code of the TREEVIEW.

 

With NOWAIT the TREEVIEW is started and the function is terminated immediately and returns the handle of the TREEVIEW. With the instruction CLOSE_TREEVIEW(<Handle>) a TREEVIEW opened by NOWAIT can be closed.

 

With WAIT the TREEVIEW is started hierarchically: The function is only terminated when the TREEVIEW is terminated.

 

The Macro <Exit Macro> is executed after the TREEVIEW has been terminated.

 

If WAIT or NOWAIT is specified, an <Exit Macro> must also be specified. With NOWAIT the variable EBUS_DATA contains in the <Exit Macro> the returncode of the TREEVIEW.

 

If the TREEVIEW is to be displayed in the split window, <Split-Windowcall Handle> must contain the handle of the split window.

 

If the TREEVIEW is to be inserted on a WINDOWCALL mask like a mask field, EBUS_CHILDWINDOW must be <> 0 and <Split-Windowcall Handle> must contain the handle of a WINDOWCALL mask.

 

If the parameters [WAIT | NOWAIT,<Exit Macro>,<Split-Windowcall Handle>] ar missing, this is equivalent to WAIT.

 

With NOWAIT all ON <Event> Macros are saved when the TREEVIEW is started and left. When the TREEVIEW is activated again the last state of the switches and ON <Event> Macros is restored. After each ON <Event> Macro that is executed in the TREEVIEW, the ON <Event> Macros are saved again.

 

<Array> is the name of the variable of a one-dimensional String Array. It is enough to define only the name of the variable without indices. The elements of <array> define the structure of the tree from top (the root) to bottom and must have the following structure:

 

<Level><Separator><Image Name><Separator><Text>

 

<Level> is a number that specifies the nesting depth of the tree. The 1st element of <Array> (that is element No. 1, element No. 0 is not considered) designates the root and therefore has the value 0 as <Level>. All following elements must have a <Level> > 0.

 

<Image Name> defines the image to be displayed in the tree. In addition, the images used in the tree should be made familiar to the program with #ADD_IMAGE so that they can be entered into the jar file.

 

<Text> is the text to be displayed next to the image in the tree.

 

<Default Value> defines which element of the tree is selected at the start of TREEVIEW. The tree is expanded automatically so that the requested element becomes visible. The <Text> of the element or the full path of the element can be specified as <Default Value>. The path consists of the texts separated by <Separator> from level 0 up to the level of the element to be selected (see example=. If only the <Text> specified and if this <Text> appears several times in the tree, the first found element is selected. If <Default Value> is the empty string "", the root element is selected.

 

<Count> is the number of elements used by SELECTA. The 1st element in the table is the element No. 1. Element No. 0 is not used by TREEVIEW. It must be secured that a correct value is transferred. It is not checked whether <Count> is bigger than the dimension of the variable. If this is the case, runtime errors are reported.

 

<Separator> defines the character by which <Level>, <Image Name> and <Text> are separated. If <Separator> is the empty string, the semi-colon ";" is the Separator.

 

<Header> defines the window header.

 

<Height in Rows> and <Width in Columns> define the size of the TREEVIEW in rows and columns.

 

<Element Height in Pixel> defines the height of the TREEVIEW elements. If <Element Height in Pixel> <= 0 the optimal height is computed by the size of the images and the size of the font.

 

<Expand Level> defines up to which level the tree is expanded at the start.

 

If <Edit> <> 0, the elements of the tree can be edited after clicking twice (Note: no double-click!). By the function TREEVIEW_EDIT_TEXT elements can be edited even if <Edit> = 0.

 

The background color of the TREEVIEW is defined by <Red>, <Green> and <Blue>. If one of these parameters < 0, the standard background color is used.

 

All ON SELECT(<Key>) Macros work in the TREEVIEW. When these Macros are executed EBUS_TREEVIEW$ contains the path and EBUS_TREEVIEW the number of the currently selected element.

 

TREEVIEW returns the following values:

 

1

The user has selected an element of the table with <RETURN> or by double-click. The variables EBUS_TREEVIEW and EBUS_TREEVIEW$ contain the selected element.

0

The user has left TREEVIEW with <Esc> or the TREEVIEW has been closed.

-1

An error has occurred. The variable OK contains one of the following error codes:

 

7903  Element not found

7906  No Treeview available in the current window

7907  <Level> not valid

7908  Table is empty

7909  First element has <Level> <> 0

7910  Later element has <Level> <= 0

7911  Treeview does not fit into Array.

7914   Root element cannot be deleted.

7925  An exception has occurred.

7926  Treeview cannot be created as mask field: the current object is not a maske.

7927  <Split-Windowcall-Handle> is not the handle of a WINDOWCALL mask.

-2

Window not found

 

Parameter:

WAIT|NOWAIT

WAIT: The function is only terminated when the TREEVIEW is terminated.

NOWAIT: The TREEVIEW is started and the function is terminated immediately.

Exit Macro

Name of the Exit-Macro

Split-Windowcall Handle

Handle of a split window in which the TREEVIEW is to be displayed or handle of a WINDOWCALL mask on which the TREEVIEW is to be inserted like a mask field.

Array

Name of the variable of a one-dimensional String-Array

Default Value

Defines the element that is selected at the start of the TREEVIEW.

Count

Number of elements of <Array> to be used.

Separator

Separators of the entries in <Array>

Header

Defines the window header.

Height in Rows

Defines the height of the TREEVIEW window.

Width in Columns

Defines the width of the TREEVIEW window.

Element Height in Pixel

Defines the height of the TREEVIEW elements.

Expand Level

Defines up to which level the tree is expanded at the start.

Edit

<> 0: The elements of the tree can be edited.

Red

Red value

Green

Green value

Blue

Blue value

 

Sample:

DIM T$(20)

 

T$(1) = "0;contact.png;Contact person"

T$(2) = "1;company.png;Fritsch GmbH"

T$(3) = "2;person.png;Huber Franz"

T$(4) = "2;person.png;Meier Josef"

T$(5) = "1;company.png;Karo Verlag"

T$(6) = "2;person.png;Hübner Jutta"

T$(7) = "2;person.png;Bauer Sigrid"

T$(8) = "2;person.png;Talhammer Bernd"

T$(9) = "2;person.png;Arndt Erich"

 

/* DAFAULT$ contains the full path

DEFAULT$ = "Contact person;Karo Verlag;Arndt Erich"

 

WINDOWPOS(0,0)

H% = TREEVIEW(T$,DEFAULT$,9,";","Contact persons",15,50,16,0)

 

IF H% = -1

THEN … Error …

ENDIF

 

See also:

CLOSE_TREEVIEW

TREEVIEW_FONT

TREEVIEW_FONTHEIGHT

TREEVIEW_FONTNAME

TREEVIEW_TEXTCOLOR

GET_TREEVIEW

GET_TREEVIEW_SIZE

GET_TREEVIEW_PATH$

TREEVIEW_CHANGE_IMAGE

TREEVIEW_CHANGE_TEXT

TREEVIEW_DELETE

TREEVIEW_DELETE_ITEM

TREEVIEW_INSERT

TREEVIEW_INSERT_ITEM

TREEVIEW_HILITE

TREEVIEW_EDIT_TEXT

EBUS_TREEVIEW

EBUS_TREEVIEW_RMOUSE

EBUS_TREEVIEW$

EBUS_CHILDWINDOW

ON TREEVIEW_EDIT MACRO

 

–