Sign in to follow this  
Followers 0
au3scr

Need some dynamic TreeView help

2 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



@au3scr

Make a small and working example to duplicate the problem.

Share this post


Link to post
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
Sign in to follow this  
Followers 0