Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The AddItems property adds new items to the existing tree. Specifically, it allows you to add new child items to an existing item. The DestItem parameter is the key of the item to which the new items should be added. Set it to "" if want to add the items to the Root Item. The NewItems parameter is formatted as an @FM delimited array of tree items. Each field in the array represents a single new item, and the multivalue structure for each field is as follows:

<1, 1><1, 2>
PosNameTypeDescriptionDefault
<1>
LevelIntegerThe item's level in the tree 
<2>
KeyTextThe item's unique key 
<1, 3>
<3>
DataTextThe item's data
""
<4>
<1, 4>
Data Type  
<1, 4,
 <4, 1>
TypeOptionThe item's data type, used to make sorting most accurate and efficient
Text
<1
 <4,
4,
 2>
FormatFormatted StringThe item's data format, used to present the data to the user
""
<5>
<1, 5>
ClassTextThe item's class, an application specific string that can used for classification purposes
""
<6>
<1, 6>
ImageFormatted StringThe item's image, either a file or a key pointing to a global image
""
<7>
<1, 7>
Colors  
<1, 7,
 <7, 1>
Text ColorColorThe color of the item's text
WindowText
<1
 <7,
7,
 2>
BackgroundColor FillThe item's background
Window
<1, 8>
<8>
FontFontThe font used to render the item's data
Tahoma, 8 pt.
<9>
<1, 9>
Alignment  
<1, 9,
 <9, 1>
HorizontalOptionThe horizontal alignment of the item's data
Left
 <9, 
<1, 9,
2>
VerticalOptionThe vertical alignment of the item's data
Center
<1, 10>
<10>
SortOptionThe item's sort setting
None
<11>
<1, 11>
Check BoxOptionThe item's check box setting
None
<12>
<1, 12>
ExpandableBooleanWhether or not the item can be expanded or collapsed by the user
1
<13>
<1, 13>
HeightIntegerThe item's height
16
<14>
<1, 14>
HyperlinkBooleanWhether or not the item displays hyperlink feedback to the user
0
<1, 15>
<15>
SelectableBooleanWhether or not the item can be selected by the user
1
<16>
Swatch ColorColor FillA custom colored rectangle that appears at the beginning or end of an item
None
<17>
Swatch PositionOptionThe position of the swatch, if there is one: Left or Right
Left
<18>
Swatch Size
 <18, 1>
WidthIntegerThe swatch width, in pixels, if there is one
13
 <18, 2>
HeightIntegerThe swatch height, in pixels, if there is one
13
<19>
FieldsList of user defined fields and their values: each value has the following format:
""
 <19, x, 1>
Field NameTextThe unique field name
""
 <19, x, 2>
Field ValueTextThe field's value
""

The first two values, Level and Key, must be included for every item. All other values are optional.

Level

The first value of every item is its level within the tree. The level will be used to determine where the item fits within the hierarchy. If an item's level is greater than the item preceding it, then it becomes that item's child. Since the SRP Tree Control is a true hierarchy, the levels will be interpreted in terms of relativity, not actual value. For example, if you set item 1 to level 1 and item 2 to level 8, item 2 will still be a direct child of item 1. It's important to note that the level is relative to the destination item's level. That is, a new item at level 1 will be added as a direct child of the destination item, not as a child of the Root Item.

...

See the Item property for more details on each of the possible values in the data structure.

Example

Code Block
// Assume a tree with boys and girls organized into teams 
// Add a couple boys and girls to the blue team 
NewItems = "" 
NewItems<-1> = 1:@VM:"Grace":@VM:"Grace":@VM:@VM:"Girl" 
NewItems<-1> = 1:@VM:"Kaylee":@VM:"Kaylee":@VM:@VM:"Girl" 
NewItems<-1> = 1:@VM:"Alexander":@VM:"Alexander":@VM:@VM:"Boy" 
NewItems<-1> = 1:@VM:"Nathan":@VM:"Nathan":@VM:@VM:"Boy" 
Send_Message(@Window:".OLE_TREE", "OLE.AddItems", "BlueTeam", NewItems)

...