Programme SAP SAPTREX1 - Example: Tree control in column mode (with documentation)

Description
Program SAPTREX1 demonstrates a tree control in column mode.
The tree has three columns. One of these is described by the Dictionarystructure TREEV_COL. Each column has a name (field NAME) by which youcan address it. In this example, the columns have the names "Column1","Column2", and "Column3".
The columns have headres (Dictionary structure TREEV_HDR). The firstheader from the left is always present and has the name (NAME field)en"HierarchyHeader" and the text "Hierarchy Header". The left-hand edgeof all columns under this header are aligned with it. The area beneaththe hierarchy header has its own horizontal scrollbar. The hierarchyheader spans column1. The header with the text "Header2" spans column2,and the header with text "Header3" spans column3.
Each node of the tree is described by the Dictionary structureTREEV_NODE. The field NODE_KEY contains the ky of the node.
Each node in the tree can possess items. An item is described by theDictionary structure TREEV_ITEM, to which the user of the tree controlmust add the character field TEXT (of any length). In this exampleprogram, TREEV_ITEM is adopted in the structure MTREEITM for thepurpose of adding the TEXT field. The field NODE_KEY determines thenode to which an item belongs. The field ITEM_NAME defines the columnin whcih the item occurs.
Example: Suppose the top-level root node has the following items:
NODE_KEY ITEM_NAME TEXT
Root Column1 Root Col. 1
Root Column2 Root Col. 2
Root Column3 Root Col. 3

Selection
The items of a node may be selected individually. To select an entirenode, click on its folder or leaf.
You can also set the tree control so that clicking anywhere on a nodealways selects the entire node (set the ITEM_SELECTION parameter of thefunction module TREEV_CREATE_COLUMN_TREE to initial). In this case, youcannot use pushbuttons, icons, or changeable checkboxes.

Events
The box on the right of the screen displays events as they occur. Youcan trigger the following events in the example program:

node_dbl_clk (node double click)
Double-click on a node. In the demonstrtation program, double-click thefolder or leaf symbol. If ITEM_SELECTION is set to SPACE, the event istriggered when you double-click any part of the node.

item_dbl_click (item double click)
Double-click on an item in the tree. This event can only occur ifITEM_SELECTION = 'X'.

item_context_men
Right mouse-click on the control. The parameters of the event are thenode key and name of the item.

node_context_men
If the user clicks the right mouse button on the folder or leaf symbol,this event is triggered. The parameter of the event is the node key.

expand_nc (expand no children)
A node may display a plus sign on its folder or leaf symbol eventthough it has no subnodes (EXPANDER field in TREEV_NODE). If the userclicks one of these nodes, the event EXPAND_NC is triggered. In theexample, the node "Child1" has this attribute. The program reacts tothe event by adding two new nodes to the control (New1 and New2).

header_click
Click on the header of a control. The name of the header is displayedin node_key-outputfield.

button_click
Click on an item that is a pushbutton.

link_click
Click on an item that is a link.