Jump to content

Need some dynamic TreeView help


au3scr
 Share

Recommended Posts

Hi all I need little help with TreeView I have made dynamic listview, now I have problem with button click, If i click on button(this button must show selected TreeViewel ement in msgbox()), program closes itself. and i get error

Z:\dff\desktop-5-12-2008\Edit.au3(227,46) : WARNING: $treeview: possibly used before declaration.
                $item = GUICtrlRead($treeview)

Here is my func that creates or destroys TreeView

Func _CreateListviewItemsFromFile ($destroy)
    $treeview = GUICtrlCreateTreeView(8, 80, 170, 180, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
    $generalitem = GUICtrlCreateTreeViewItem("General", $treeview)
    
        $flines = _FileCountLines("C:file.txt")
    $cl = 1
    For $i = 1 to $flines
        $cl = $cl + 1
        $dynamic = GUICtrlCreateTreeViewItem(FileReadLine("C:file.txt",$cl),$generalitem)
    Next
    $Button1 = GUICtrlCreateButton("&Open File", 8, 260, 70, 20)
    GUICtrlSetState($generalitem, BitOR($GUI_EXPAND, $GUI_DEFBUTTON))
    If $destroy = 0 Then
        GUICtrlDelete($treeview)
        GUICtrlDelete($generalitem)
        GUICtrlDelete($dynamic)
        GUICtrlDelete($Button1)
    EndIf   
EndFuncoÝ÷ Ù8Z¶Ëa{²"ë¶éb²Ûâ{.±æî¶Ú'¶+y«^¢·^ë^+-¾'°jëh×6Case $Button0
_CreateListviewItemsFromFile (1);IF value is 0 Func wont create treeview

So I have Gui with buttons, 1 button can Create or destroy treeview. And an other button tells me which element I have picked from Treeviw.

So called "other" button causes me a problem" , how I could fix that other button?

other button gets me that error when I click on it.

--------

Post if you have questions

Edited by au3scr
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...