Tree View (PRIM_TRVW)

Hierarchical display of data

Ancestors - Control (PRIM_CTRL)Object (PRIM_OBJT)

Details

A TreeView is a hierarchical display of data showing items within item within items.
 
TreeView is a typical LANSA list control managed by the LANSA list commands, such as ADD_ENTRY, GET_ENTRY, SELECTLIST etc.
 
Columns are added to the tree. Each has a Source and data values are mapped in and out of the list as items are used.
 
TreeView has two variation based on the ViewStyle property.
 
Levelled tree uses the KeyPosition property of columns to determine the hierarchy. Changes to data values automatically cause nesting of child items. However, only one value can be see for each item in the tree and the number of level is governed by the number of columns added.
 
Unlevelled trees have no such automation, requiring that the user control the nesting of items via the ParentItem property. Unlevelled trees can have many levels and can show many columns of data. While they are less automated, they are far more flexible and powerful.

Example

In this example, an unlevelled tree adds 4 child items to the expanding item.
 
The first column shows the item number for the branch while the second shows the underlying list entry number.
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientwidth(480) Clientheight(398) Left(259) Top(261) Height(437) Width(496) Layoutmanager(#TableLayout1)
 
   Define_Com Class(#PRIM_TBLO) Name(#TableLayout1)
   Define_Com Class(#PRIM_TBLO.Column) Name(#Column1) Displayposition(1) Parent(#TableLayout1)
   Define_Com Class(#PRIM_TBLO.Row) Name(#Row1) Displayposition(1) Parent(#TableLayout1)
   Define_Com Class(#PRIM_TBLO.Item) Name(#TreeView1Item1) Column(#Column1) Manage(#Tree) Parent(#TableLayout1) Row(#Row1)
 
   Define_Com Class(#PRIM_TRVW) Name(#Tree) Columnbuttonheight(19) Componentversion(2) Displayposition(1) Height(398) Keyboardpositioning(SortColumn) Left(0) Parent(#COM_OWNER) Tabposition(1) Top(0) Width(480) Viewstyle(UnLevelled) Fullrowselect(True)
   Define_Com Class(#PRIM_TVCL) Name(#TreeViewColumn2) Displayposition(1) Level(2) Parent(#Tree) Source(#STD_NUM) Width(28) Captiontype(Caption) Caption('Item number')
   Define_Com Class(#PRIM_TVCL) Name(#TreeViewColumn3) Displayposition(2) Level(2) Parent(#Tree) Source(#STD_IDNO) Width(32) Captiontype(Caption) Caption('List Entry')
 
   Evtroutine Handling(#Com_owner.CreateInstance)
 
      #Com_Self.Add4Items
 
   Endroutine
 
   Mthroutine Name(Add4Items)
   Define_Map For(*input) Class(#Prim_tvit) Name(#ParentItem) Mandatory(*Null) Pass(*By_reference)
 
      Begin_Loop Using(#Std_num) To(4)
 
         Add_Entry To_List(#Tree)
         #std_idno := #Tree.CurrentItem.Entry
         Upd_Entry In_List(#Tree)
 
         #Tree.CurrentItem.ParentItem <= #ParentItem
         #Tree.CurrentItem.HasChildren := Unknown
 
      End_Loop
 
   Endroutine
 
   Evtroutine Handling(#Tree.ItemExpanding)
 
      If (#Tree.CurrentItem.HasChildren <> Yes)
         #Com_Self.Add4Items( #Tree.currentitem )
      Endif
 
   Endroutine
 
End_Com

Properties

Name Description
BusyUpdates BusyUpdates specifies how the control updates itself Inherited from Control (PRIM_CTRL)
BusyUpdatesOfParent BusyUpdatesOfParent specifies whether the parent controls updates Inherited from Control (PRIM_CTRL)
CanFocus CanFocus returns a value indicating whether the control can receive keyboard focus Inherited from Control (PRIM_CTRL)
ColumnButtonHeight Specifies the height of the buttons shown at the top of the list
ColumnEllipses Show ellipses for truncated text
ColumnHeaders ColumnHeaders sets column headers on and off
ColumnResize Specifies whether the column can be manually resized
Columns Columns gives you access to the properties of the columns
ComponentClassName ComponentClassName is the name of the component's class. Inherited from Object (PRIM_OBJT)
ComponentMembers ComponentMembers provides access to all the member components of this component Inherited from Object (PRIM_OBJT)
ComponentPatternName ComponentPatternName is used to qualify the class of the component. Inherited from Object (PRIM_OBJT)
ComponentTag Generic space allowing a value to be stored for the instance Inherited from Object (PRIM_OBJT)
ComponentType ComponentType gives you access to the type information about the component Inherited from Object (PRIM_OBJT)
ComponentTypeName ComponentTypeName is the fully qualified name of the component's class. Inherited from Object (PRIM_OBJT)
ComponentVersion Variant of the control being used
CurrentItem The last item in the list touched either in the UI or via a list related command
Cursor Cursor sets the cursor image Inherited from Control (PRIM_CTRL)
DisplayPosition DisplayPosition determines the order in which components are shown Inherited from Control (PRIM_CTRL)
DragColumns Allow columns to be reordered
DragStyle DragStyle determines how a component can be dragged Inherited from Control (PRIM_CTRL)
Enabled Enable activates/deactivates the component Inherited from Control (PRIM_CTRL)
Entries The number of entries in the underlying data list
EntriesAtRoot Number of items at the root level of the tree
FixedPosition Fix the control position so that it does not move if the parent is scrolled Inherited from Control (PRIM_CTRL)
Focus Focus tells whether the component has focus Inherited from Control (PRIM_CTRL)
FocusedStyle Reference to a style to be applied when the control is focus Inherited from Control (PRIM_CTRL)
FocusedStyles Collection of styles to be applied when the control is focus Inherited from Control (PRIM_CTRL)
FocusItem Reference to the focus item in the list
FullRowSelect Show item selection as the whole row or just the item text
Handle Returns the Windows handle in desktop applications Inherited from Control (PRIM_CTRL)
HasButtons Show the expand and collapse image
HasLines Show the lines that join parent and child nodes
Height The height of the control in pixels Inherited from Control (PRIM_CTRL)
Hint Caption displayed when the mouse hovers over the control Inherited from Control (PRIM_CTRL)
HintPopup HintPopup allows a PopupPanel instance to be used instead of the default hint text box Inherited from Control (PRIM_CTRL)
HintShow Enabled or disable the appearance of hints Inherited from Control (PRIM_CTRL)
HintShowOfParent Delegate hints appearance to the parent control Inherited from Control (PRIM_CTRL)
HintTitle HintTitle defines the text shown at the top of the hint window in emphasized text Inherited from Control (PRIM_CTRL)
IsAnimating IsAnimating indicates that a control is currently being animated Inherited from Control (PRIM_CTRL)
IsRealized True if the control is currently realized Inherited from Control (PRIM_CTRL)
Items Collection of items in the component
KeyboardPositioning Determines how the list will position based on keyboard input
Left Position of the control relative to the left boundary of its parent Inherited from Control (PRIM_CTRL)
LinesAtRoot Show parent child lines to the left of root level nodes
ManageChildren ManageChildren controls what happens when a tree item is collapsed
Modified Modified indicates that the contents of the component have changed Inherited from Control (PRIM_CTRL)
ModifiedRules Controls when the Modified property is set to True
MouseOver MouseOver determines whether the mouse is directly over a control Inherited from Control (PRIM_CTRL)
MouseOverPart True if the cursor is within the bounds of a child component
MouseOverStyle MouseOverStyle defines the style to be applied to a control when the mouse is over it Inherited from Control (PRIM_CTRL)
MouseOverStyles MouseOverStyles is a collection of styles to be applied to a control when the mouse is over it Inherited from Control (PRIM_CTRL)
MultipleSelectStyle Specifies how selection works across different branches
Name Name identifies the component Inherited from Object (PRIM_OBJT)
NotificationStyle NotificationStyle controls how events are triggered
Opacity Opacity denotes the appearance of a control in terms of its interaction with its background Inherited from Control (PRIM_CTRL)
Owner Owner owns this component Inherited from Object (PRIM_OBJT)
Parent Reference to the control in which this control is visually positioned Inherited from Control (PRIM_CTRL)
Popup Popup allows a PopupPanel instance to be used instead of the typical right click popup menu Inherited from Control (PRIM_CTRL)
PopupMenu Reference to a PopupMenu to be shown on a right click Inherited from Control (PRIM_CTRL)
PopupMenuFocusSelect Set focus to the list item when a context menu is displayed
Rotation Rotation allows a control to rotate a number of degrees about a given origin Inherited from Control (PRIM_CTRL)
RotationOriginLeft RotationOriginLeft defines the left coordinate of an imaginary point around which a control will rotate Inherited from Control (PRIM_CTRL)
RotationOriginTop RotationOriginTop defines the top coordinate of an imaginary point around which a control will rotate Inherited from Control (PRIM_CTRL)
RowHeight Height of an item in pixels
ScaleHeight ScaleHeight is the percentage of the height to use in the visual appearance of a control Inherited from Control (PRIM_CTRL)
ScaleOriginLeft ScaleOriginLeft defines the left coordinate of an imaginary point from which a control will scale Inherited from Control (PRIM_CTRL)
ScaleOriginTop ScaleOriginTop defines the top coordinate of an imaginary point from which a control will scale Inherited from Control (PRIM_CTRL)
ScaleWidth ScaleWidth is the percentage of the width to use in the visual appearance of a control Inherited from Control (PRIM_CTRL)
ScreenLeft ScreenLeft sets the distance from the left of the screen Inherited from Control (PRIM_CTRL)
ScreenTop ScreenTop sets the distance from the top of the screen Inherited from Control (PRIM_CTRL)
ScrollLeft Left position of a horizontally scrolled child control relative to its parent control Inherited from Control (PRIM_CTRL)
ScrollTop Top position of a vertically scrolled child control relative to its parent control Inherited from Control (PRIM_CTRL)
SelectionStyle Specifies the rules for item selection within the list
ShowItemHint Enable hints for the item
ShowSelection Show selection when the control does not have focus
SkewLeft SkewLeft defines the angle at which to skew the control horizontally Inherited from Control (PRIM_CTRL)
SkewOriginLeft SkewOriginLeft defines the left coordinate of an imaginary point from which a control will skew Inherited from Control (PRIM_CTRL)
SkewOriginTop SkewOriginTop defines the top coordinate of an imaginary point from which a control will skew Inherited from Control (PRIM_CTRL)
SkewTop SkewTop defines the angle at which to skew the control vertically Inherited from Control (PRIM_CTRL)
SplitStyle SplitStyle enables independent pane scrolling
Style Style defines the style to be applied to a control Inherited from Control (PRIM_CTRL)
Styles Collection of styles to be applied to the control Inherited from Control (PRIM_CTRL)
TabPosition TabPosition sets the order of focus when the Tab key is used Inherited from Control (PRIM_CTRL)
TabStop Set to false to stop focus being given to the control via the Tab key Inherited from Control (PRIM_CTRL)
ThemeDrawStyle Name of the Theme DrawStyle to be applied to the control Inherited from Control (PRIM_CTRL)
Top Position of the control relative to the top boundary of its parent Inherited from Control (PRIM_CTRL)
TouchMove Determines how the control will respond to touch move processing Inherited from Control (PRIM_CTRL)
TouchRotate Determines how the control will respond to touch rotation Inherited from Control (PRIM_CTRL)
TouchScale Determines how the control will respond to touch scaling Inherited from Control (PRIM_CTRL)
TouchScroll Specifies how the control will respond to touch input for scrolling
TouchSize Determines whether a control can be resized Inherited from Control (PRIM_CTRL)
ValueAt Value at the specified location
ViewPopupMenu ViewpopupMenu specifies the popup menu for the view area
ViewStyle ViewStyle sets the way the list or tree is shown
Visible Show or hide the control Inherited from Control (PRIM_CTRL)
VisualStyle VisualStyle sets the appearance Inherited from Control (PRIM_CTRL)
VisualStyleOfParent Adopt the Visual style from the parent control Inherited from Control (PRIM_CTRL)
Width Width of the component in pixels Inherited from Control (PRIM_CTRL)

Events

Name Description
AnimationEnded Fired when an animation is ended Inherited from Control (PRIM_CTRL)
Cancelled
Changed Changed is a change in the component
CreateInstance CreateInstance is signalled when an instance of a component is created Inherited from Control (PRIM_CTRL)
DestroyInstance DestroyInstance is signalled when an instance of a component is about to be destroyed Inherited from Control (PRIM_CTRL)
DoubleClick Fired when the user double clicks
ExpandItem
DragDrop Fired on mouse up to signify the end of a drag process Inherited from Control (PRIM_CTRL)
PosX, PosY, Source, Payload, AggregatedSource, Origin, Handled, DragResult
DragOver Fired during the drag and drop process when the cursor moves over the control Inherited from Control (PRIM_CTRL)
PosX, PosY, Source, Payload, DragState, AcceptDrop, DragCursor, ShowDropHilight, AggregatedSource, Origin, Handled
EditorChanged Fired when the user changes a value in an editable cell
Value
EndDrag Fired when the drag and drop process has completed Inherited from Control (PRIM_CTRL)
Source, Payload, DragResult, AggregatedSource, Origin, Handled
Enter Fired when the Enter key is pressed
KeyCode, Char, IsAltDown, IsControlDown, IsShiftDown, Handled
GotFocus Fired when the control receives the focus
Initialize Fired after a component has been realized for the first time Inherited from Control (PRIM_CTRL)
ItemChanged ItemChanged happens when an item is changed
ItemChangedAccept ItemChangedAccept event is triggered when an item is about to be changed
Accept, Reason, Continue, Value
ItemCollapsed ItemCollapsed is the event of a tree view closing up a level of entries
ItemExpanding ItemExpanding is the event of tree view showing the next level entries
ItemGotFocus Fired when an item receives the focus
ItemGotFocusAccept ItemGotFocusAccept is fired when the item gets focus
Accept, Reason
ItemGotSelection Fired when an item in the list becomes selected
ItemGotSelectionAccept Fired when an item in the list is about to become selected
Accept, Reason
ItemHintText Fired when the hint is about to be shown
Caption
ItemLostFocus Fired when the item loses focus
ItemLostFocusAccept Fired when an item in the list is about to lose focus
Accept, Reason
ItemLostSelection ItemLostSelection happens when another item is selected
ItemLostSelectionAccept Fired when an item in the list is about to lose selection
Accept, Reason
ItemMouseEnter The mouse has entered the bounds of the item
ItemMouseHover The mouse is hovering over the item
ItemMouseLeave The mouse has left the bounds of the item
KeyPress Fired when a key is pressed on the keyboard
KeyCode, Char, IsAltDown, IsControlDown, IsShiftDown, Handled
LostFocus LostFocus happens when a component is no longer active
MouseEnter The mouse has entered the bounds of the control Inherited from Control (PRIM_CTRL)
MouseHover The mouse has hovered over the control Inherited from Control (PRIM_CTRL)
Origin, Handled
MouseLeave The mouse has left the bounds of the control Inherited from Control (PRIM_CTRL)
PrompterAccept Fired when a value is selected in a prompter
Form, ApplyValue, FocusAction, ReshowPrompter
PrompterActivate Fired when the prompter image is clicked
Form, Continue
PrompterDeactivate Fired when the prompter is closed
Form
StartDrag Fired when the user starts a drag and drop process Inherited from Control (PRIM_CTRL)
Source, Payload, Continue, DragList, AggregatedSource, Origin, Handled
TouchChange Fired repeatedly between the TouchStart and TouchEnd boundaries to provide details of the touch events Inherited from Control (PRIM_CTRL)
MoveLeft, MoveTop, ScaleWidth, ScaleHeight, Rotation, Continue
TouchEnd Fired when the user stops touching the screen Inherited from Control (PRIM_CTRL)
TouchStart Fired when the user first makes physical contact with the screen Inherited from Control (PRIM_CTRL)
Origin, TouchMove, TouchRotate, TouchScale, TouchSize
ViewDoubleClick Fired when the user double clicks in a part of the list not occupied by a list item

Methods

Name Description
CollapseAll Collapse all tree nodes to hide child items
ExpandAll Expand all tree items to show child nodes
FadeIn Animate from invisible to visible Inherited from Control (PRIM_CTRL)
Duration, Delay
FadeOut Animate from visible to invisible Inherited from Control (PRIM_CTRL)
Duration, Delay, Visible
FindItem Search for an object stored in the item RelatedReference property
Result, RelatedReference, StartItem
MoveFrom Move a control from the specified position to the current position Inherited from Control (PRIM_CTRL)
Left, Top, Duration, Delay
MoveTo Animate a move from the specified number of pixels Inherited from Control (PRIM_CTRL)
Left, Top, Duration, Delay
Realize Creates the visual portion of dynamically created controls Inherited from Control (PRIM_CTRL)
Scale Animate a change of scale Inherited from Control (PRIM_CTRL)
ScaleWidth, ScaleHeight, Duration, Delay
SetFocus Sets the control to be the focus control Inherited from Control (PRIM_CTRL)
SetValueAt Set the value at the specified position
Result, Row, Column, Value
ShowMessages LANSA Internal Use Inherited from Control (PRIM_CTRL)
SizeTo Changes and animates control size changing Inherited from Control (PRIM_CTRL)
Width, Height, Duration, Delay
StartEdit StartEdit method is a programmatic way of starting the edit of the current item
StartSplit StartSplit enables independent pane scrolling
Unrealize Destroys the visual portion of dynamically created controls Inherited from Control (PRIM_CTRL)
UpdateDisplay UpdateDisplay updates the display immediately Inherited from Control (PRIM_CTRL)

See also

All Component Classes

Technical Reference

LANSA Version 15, April 2020