#include <Array.au3>
#include <GUIConstants.au3>
Dim $data
Dim $b
GUICreate("dynaTree test",300,300)
Dim $tree = GUICtrlCreateTreeView(10, 10, 280, 280)
GUISetState(@SW_SHOW)
$section = IniReadSectionNames(@ScriptDir & "\phones.ini")
If @error Then
MsgBox(4096, "", "Error occurred, probably no INI file.")
Else
Dim $MainTreeViewItems[$section[0]+1]
$MainTreeViewItems[0] = $section[0]
For $i = 1 To $section[0]
$MainTreeViewItems[$i] GUICtrlCreateTreeViewItem($section[$i],$tree)
Next
EndIf
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
For $i = 1 To $section[0]
CreateItem($i*3, $i)
Next
func CreateItem($ItemToAdd, $SectionNumber)
GUICtrlCreateTreeViewItem($ItemToAdd, $MainTreeViewItems[$SectionNumber])
endfunc
Does this help?