Tree Item - ParentItem Property

Reference to the parent item

Member of Tree Item (PRIM_TREE.TreeItem)

Data Type - PRIM_TREE.TreeItem - Reference to the Tree containing the item

Details

The ParentItem property is the item in the list containing the item.

Items at the root of the list will have a ParentItem of Null.

Example

This example is a simple list that adds 5 items. Whenever an item is expanded, the list adds 5 child items to the expanding item.
Prim_Tree uses the same ParentItem technique as Prim_List.

     Begin_Com Role(*EXTENDS #PRIM_WEB) Height(456) Width(864) 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(#ListItem1) Column(#Column1) Manage(#List) Parent(#TableLayout1) Row(#Row1)
        Define_Com Class(#PRIM_List) Name(#List) Displayposition(1) Height(456) Left(0) Parent(#COM_OWNER) Tabposition(1) Top(0) Width(864) Columnlines(False) Rowlines(False)
Define_Com Class(#PRIM_LIST.Number) Name(#ColumnXDEMONUMB1) Displayposition(1) Increment(1) Parent(#List) Source(#xDemoNumber) Wrap(False) Columnwidth(216)
        Evtroutine Handling(#Com_owner.CreateInstance) 
           #Com_Self.Add5Items 
        Endroutine 
        Mthroutine Name(Add5Items)
Define_Map For(*input) Class(#PRIM_List.ListItem) Name(#ParentItem) Mandatory(*Null) Pass(*By_reference)
           Begin_Loop Using(#xDemoNumber) To(5) 
              Add_Entry To_List(#List) 
              #List.CurrentItem.ParentItem <= #ParentItem
#List.CurrentItem.HasChildren := Unknown
           End_Loop 
        Endroutine 
        Evtroutine Handling(#List.ItemExpanding) 
           If (#List.CurrentItem.HasChildren <> Yes)
#Com_Self.Add5Items( #List.currentitem )
Endif
        Endroutine 
     End_Com


See also

All Component Classes

Technical Reference

  • No labels