Eli Posted August 24, 2006 Share Posted August 24, 2006 (edited) I'm trying to dynamically update a treeview from an .ini I got it so that it will create main headings from the ini sections I cant seem to get it to populate with sub headings from the keys/values can you have a piece of script create variables? #include <Array.au3> #include <GUIConstants.au3> Dim $data Dim $b GUICreate("dynaTree test",300,300) $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 For $i = 1 To $section[0] GUICtrlCreateTreeViewItem($section[$i],$tree) Next EndIf While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE GUIDelete() Exit EndSelect WEnd this updates the tree with -Head1 -Head2 -Head3 what I cant get is the sub items -Head1 -item -Head2 -item my current script doesnt assign the treeviewitems to a variable for me to assign the items to Edited August 24, 2006 by Eli Link to comment Share on other sites More sharing options...
Danny35d Posted August 24, 2006 Share Posted August 24, 2006 check this post it may help you AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
Eli Posted August 24, 2006 Author Share Posted August 24, 2006 ah, I do a search really I did! I dont understand most of the code, but I should be able to piece it together! thank you! Link to comment Share on other sites More sharing options...
Eli Posted August 24, 2006 Author Share Posted August 24, 2006 whats the [#] after a variable? ie $x[0] Link to comment Share on other sites More sharing options...
azeazezar Posted August 24, 2006 Share Posted August 24, 2006 expandcollapse popup#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? Link to comment Share on other sites More sharing options...
azeazezar Posted August 24, 2006 Share Posted August 24, 2006 (edited) whats the [#] after a variable? ie $x[0] while declareing the variable its the amount of stuff you can put in it while using the variable it is a lot of strings and numbers ect that you can store or read example: Dim $Array[5] ;creates an array for $i = 0 to 4 ;Fills the array $array[$i] = "This is element " & $i next for $i = 0 to 4; displays the array msgbox(0,"", $array[$i]) next Edited August 24, 2006 by azeazezar Link to comment Share on other sites More sharing options...
Eli Posted August 24, 2006 Author Share Posted August 24, 2006 awesome, good stuff that script you posted azeazezar, only populated the sections in the treeview not the subheadings I think I get whats going on, I'm going to play with it tomorrow morning when brain is fresh thank you all! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now