Jump to content

_GUICtrlTreeView_FindItem


Madza91
 Share

Recommended Posts

How to make search for item in treeview?

#include <GuiConstants.au3>
#include <GuiTreeView.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hTreeView

Example_Internal()
Example_External()

Func Example_Internal()

    Local $hItem[10], $hItemFound
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
    GUICreate("(Internal) TreeView Find Item", 400, 300)

    $hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    GUISetState()

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

    _GUICtrlTreeView_BeginUpdate ($hTreeView)
    For $x = 0 To 3
        $hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
        For $y = 0 To 2
            GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
        Next
    Next
    $hItem[4] = GUICtrlCreateTreeViewItem(StringFormat("Looking for me?", $x), $hTreeView)
    For $x = 5 To 9
        $hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
        For $y = 0 To 2
            GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
        Next
    Next
    _GUICtrlTreeView_EndUpdate ($hTreeView)

    $hItemFound = _GUICtrlTreeView_FindItem($hTreeView, "Looking for me?")
    If $hItemFound Then
        MsgBox(4160, "Information", "Item Found:" & @LF & "Handle: " & $hItemFound & @LF & "Text: " & _GUICtrlTreeView_GetText($hTreeView, $hItemFound))
    Else
        MsgBox(4160, "Information", "Not Found")
    EndIf

; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc  ;==>Example_Internal

Func Example_External()

    Local $GUI, $hItem[10], $hItemFound
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
    $GUI = GUICreate("(External) TreeView Find Item", 400, 300)

    $hTreeView = _GUICtrlTreeView_Create ($GUI, 2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    GUISetState()

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

    _GUICtrlTreeView_BeginUpdate ($hTreeView)
    For $x = 0 To 3
        $hItem[$x] = _GUICtrlTreeView_Add ($hTreeView, 0, StringFormat("[%02d] New Item", $x))
        For $y = 0 To 2
            _GUICtrlTreeView_AddChild ($hTreeView, $hItem[$x], StringFormat("[%02d] New Item", $y))
        Next
    Next
    $hItem[4] = _GUICtrlTreeView_Add ($hTreeView, 0, "Looking for me?")
    For $x = 5 To 9
        $hItem[$x] = _GUICtrlTreeView_Add ($hTreeView, 0, StringFormat("[%02d] New Item", $x))
        For $y = 0 To 2
            _GUICtrlTreeView_AddChild ($hTreeView, $hItem[$x], StringFormat("[%02d] New Item", $y))
        Next
    Next
    _GUICtrlTreeView_EndUpdate ($hTreeView)

    $hItemFound = _GUICtrlTreeView_FindItem($hTreeView, "Looking for me?")
    If $hItemFound Then
        MsgBox(4160, "Information", "Item Found:" & @LF & "Handle: " & $hItemFound & @LF & "Text: " & _GUICtrlTreeView_GetText($hTreeView, $hItemFound))
    Else
        MsgBox(4160, "Information", "Not Found")
    EndIf

; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc  ;==>Example_External

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview
    $hWndTreeview = $hTreeView
    If Not IsHWnd($hTreeView) Then $hWndTreeview = GUICtrlGetHandle($hTreeView)

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndTreeview
            Switch $iCode
                Case $NM_CLICK ; The user has clicked the left mouse button within the control
                    _DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode)
;~                  Return 1; nonzero to not allow the default processing
                    Return 0; zero to allow the default processing
                Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control
                    _DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode)
;~                  Return 1; nonzero to not allow the default processing
                    Return 0; zero to allow the default processing
                Case $NM_RCLICK ; The user has clicked the right mouse button within the control
                    _DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode)
;~                  Return 1; nonzero to not allow the default processing
                    Return 0; zero to allow the default processing
                Case $NM_RDBLCLK ; The user has clicked the right mouse button within the control
                    _DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode)
;~                  Return 1; nonzero to not allow the default processing
                    Return 0; zero to allow the default processing
                Case $NM_KILLFOCUS; control has lost the input focus
                    _DebugPrint("$NM_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode)
                ; No return value
                Case $NM_RETURN; control has the input focus and that the user has pressed the key
                    _DebugPrint("$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode)
;~                  Return 1; nonzero to not allow the default processing
                    Return 0; zero to allow the default processing
;~              Case $NM_SETCURSOR; control is setting the cursor in response to a WM_SETCURSOR message
;~                  Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
;~                  $hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
;~                  $iIDFrom = DllStructGetData($tinfo, "IDFrom")
;~                  $iCode = DllStructGetData($tinfo, "Code")
;~                  _DebugPrint("$NM_SETCURSOR" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~                          "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~                          "-->Code:" & @TAB & $iCode & @LF & _
;~                          "-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
;~                          "-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
;~                          "-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
;~                          "-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
;~                          "-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
;~                  Return 0; to enable the control to set the cursor
;~                  Return 1; nonzero to prevent the control from setting the cursor
                Case $NM_SETFOCUS; control has received the input focus
                    _DebugPrint("$NM_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode)
                ; No return value
                Case $TVN_BEGINDRAG, $TVN_BEGINDRAGW
                    _DebugPrint ("$TVN_BEGINDRAG")
                Case $TVN_BEGINLABELEDIT, $TVN_BEGINLABELEDITW
                    _DebugPrint ("$TVN_BEGINLABELEDIT")
                Case $TVN_BEGINRDRAG, $TVN_BEGINRDRAGW
                    _DebugPrint ("$TVN_BEGINRDRAG")
                Case $TVN_DELETEITEM, $TVN_DELETEITEMW
                    _DebugPrint ("$TVN_DELETEITEM")
                Case $TVN_ENDLABELEDIT, $TVN_ENDLABELEDITW
                    _DebugPrint ("$TVN_ENDLABELEDIT")
                Case $TVN_GETDISPINFO, $TVN_GETDISPINFOW
                    _DebugPrint ("$TVN_GETDISPINFO")
                Case $TVN_GETINFOTIP, $TVN_GETINFOTIPW
                    _DebugPrint ("$TVN_GETINFOTIP")
                Case $TVN_ITEMEXPANDED, $TVN_ITEMEXPANDEDW
                    _DebugPrint ("$TVN_ITEMEXPANDED")
                Case $TVN_ITEMEXPANDING, $TVN_ITEMEXPANDINGW
                    _DebugPrint ("$TVN_ITEMEXPANDING")
                Case $TVN_KEYDOWN
                    _DebugPrint ("$TVN_KEYDOWN")
                Case $TVN_SELCHANGED, $TVN_SELCHANGEDW
                    _DebugPrint ("$TVN_SELCHANGED")
                Case $TVN_SELCHANGING, $TVN_SELCHANGINGW
                    _DebugPrint ("$TVN_SELCHANGING")
                Case $TVN_SETDISPINFO, $TVN_SETDISPINFOW
                    _DebugPrint ("$TVN_SETDISPINFO")
                Case $TVN_SINGLEEXPAND
                    _DebugPrint ("$TVN_SINGLEEXPAND")
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc  ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
    ConsoleWrite( _
            "!===========================================================" & @LF & _
            "+======================================================" & @LF & _
            "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
            "+======================================================" & @LF)
EndFunc  ;==>_DebugPrint

I founded this in autoit examples but not works,why?

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

#include <GuiConstants.au3>
#include <GuiTreeView.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Example_Internal()
Example_External()

Func Example_Internal()

    Local $hItem[10], $hItemFound, $hTreeView
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
    
    GUICreate("(Internal) TreeView Find Item", 400, 300)

    $hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    GUISetState()

    _GUICtrlTreeView_BeginUpdate ($hTreeView)
    For $x = 0 To 3
        $hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
        For $y = 0 To 2
            GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
        Next
    Next
    $hItem[4] = GUICtrlCreateTreeViewItem(StringFormat("Looking for me?", $x), $hTreeView)
    For $x = 5 To 9
        $hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
        For $y = 0 To 2
            GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
        Next
    Next
    _GUICtrlTreeView_EndUpdate ($hTreeView)

    $hItemFound = _GUICtrlTreeView_FindItem($hTreeView, "Looking for me?")
    If $hItemFound Then
        MsgBox(4160, "Information", "Item Found:" & @LF & "Handle: " & $hItemFound & @LF & "Text: " & _GUICtrlTreeView_GetText($hTreeView, $hItemFound))
    Else
        MsgBox(4160, "Information", "Not Found")
    EndIf

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example_Internal

Func Example_External()

    Local $GUI, $hItem[10], $hItemFound, $hTreeView
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
    
    $GUI = GUICreate("(External) TreeView Find Item", 400, 300)

    $hTreeView = _GUICtrlTreeView_Create ($GUI, 2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    GUISetState()

    _GUICtrlTreeView_BeginUpdate ($hTreeView)
    For $x = 0 To 3
        $hItem[$x] = _GUICtrlTreeView_Add ($hTreeView, 0, StringFormat("[%02d] New Item", $x))
        For $y = 0 To 2
            _GUICtrlTreeView_AddChild ($hTreeView, $hItem[$x], StringFormat("[%02d] New Item", $y))
        Next
    Next
    $hItem[4] = _GUICtrlTreeView_Add ($hTreeView, 0, "Looking for me?")
    For $x = 5 To 9
        $hItem[$x] = _GUICtrlTreeView_Add ($hTreeView, 0, StringFormat("[%02d] New Item", $x))
        For $y = 0 To 2
            _GUICtrlTreeView_AddChild ($hTreeView, $hItem[$x], StringFormat("[%02d] New Item", $y))
        Next
    Next
    _GUICtrlTreeView_EndUpdate ($hTreeView)

    $hItemFound = _GUICtrlTreeView_FindItem($hTreeView, "Looking for me?")
    If $hItemFound Then
        MsgBox(4160, "Information", "Item Found:" & @LF & "Handle: " & $hItemFound & @LF & "Text: " & _GUICtrlTreeView_GetText($hTreeView, $hItemFound))
    Else
        MsgBox(4160, "Information", "Not Found")
    EndIf

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example_External

Works for me, it finds the item and returns the handle to the item.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

C:\Documents and Settings\Nemanja\Desktop\New AutoIt v3 Script.au3(6,126) : WARNING: $Debug_TV possibly not declared/created yet
$Debug_TV = False; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Nemanja\Desktop\New AutoIt v3 Script.au3(14,42) : WARNING: $TVS_EDITLABELS: possibly used before declaration.
    Local $iStyle = BitOR($TVS_EDITLABELS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Nemanja\Desktop\New AutoIt v3 Script.au3(14,42) : ERROR: $TVS_EDITLABELS: undeclared global variable.
    Local $iStyle = BitOR($TVS_EDITLABELS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Nemanja\Desktop\New AutoIt v3 Script.au3(21,45) : ERROR: _GUICtrlTreeView_BeginUpdate(): undefined function.
    _GUICtrlTreeView_BeginUpdate ($hTreeView)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Nemanja\Desktop\New AutoIt v3 Script.au3(35,43) : ERROR: _GUICtrlTreeView_EndUpdate(): undefined function.
    _GUICtrlTreeView_EndUpdate ($hTreeView)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Nemanja\Desktop\New AutoIt v3 Script.au3(37,74) : ERROR: _GUICtrlTreeView_FindItem(): undefined function.
    $hItemFound = _GUICtrlTreeView_FindItem($hTreeView, "Looking for me?")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Nemanja\Desktop\New AutoIt v3 Script.au3(39,151) : ERROR: _GUICtrlTreeView_GetText(): undefined function.
        MsgBox(4160, "Information", "Item Found:" & @LF & "Handle: " & $hItemFound & @LF & "Text: " & _GUICtrlTreeView_GetText($hTreeView, $hItemFound)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Nemanja\Desktop\New AutoIt v3 Script.au3(57,91) : ERROR: _GUICtrlTreeView_Create(): undefined function.
    $hTreeView = _GUICtrlTreeView_Create ($GUI, 2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Nemanja\Desktop\New AutoIt v3 Script.au3(62,94) : ERROR: _GUICtrlTreeView_Add(): undefined function.
        $hItem[$x] = _GUICtrlTreeView_Add ($hTreeView, 0, StringFormat("[%02d] New Item", $x))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Nemanja\Desktop\New AutoIt v3 Script.au3(64,99) : ERROR: _GUICtrlTreeView_AddChild(): undefined function.
            _GUICtrlTreeView_AddChild ($hTreeView, $hItem[$x], StringFormat("[%02d] New Item", $y))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\Nemanja\Desktop\New AutoIt v3 Script.au3 - 8 error(s), 2 warning(s)

Why not work for me? :S

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

Yes, i have 3.2.9.4beta :|

...but i want to make search for treeview items...to type in edit and on button click to bee selected item with name who is typed in edit :S

(Sorry for bad english) <_<

Edited by n3nE

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

I am opened autoit beta and browse for _GUICtrlTreeView_FindItem.au3 file and opened...works but that is not what I want to make :/

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

Example_Internal() - works OK on my WIN98

Example_External() - doesn't work on my WIN98 -> treeview items are created but all have empty text (no error message)

I'm going to take a wild guess, that you never used the create in the A3L libraries, because that is where that is from.

Can't check Win98, but checked on Win2k, works fine.

Edited by GaryFrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

I'm going to take a wild guess, that you never used the create in the A3L libraries, because that is where that is from.

Can't check Win98, but checked on Win2k, works fine.

You are right I never used _TreeView_Create() and _TreeView_Add() from A3L.

I intensively used many treeview functions from A3L to manipulate external treeviews but not create them

So this WIN98 bug probably comes from A3L.

I think it's somewhere inside _TreeView_AddNode() in A3L.

Link to comment
Share on other sites

You are right I never used _TreeView_Create() and _TreeView_Add() from A3L.

I intensively used many treeview functions from A3L to manipulate external treeviews but not create them

So this WIN98 bug probably comes from A3L.

I think it's somewhere inside _TreeView_AddNode() in A3L.

it's called _GUICtrlTreeView_AddItem now, like I said don't have win98 to debug the code on, might try putting some debug code in it to see what it's doing.

It should work the same, but could be a bug from the A3L that wasn't found.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

oh yes, Gary gave to me solution already but I not understand how to add in this script?!

#include <GUIConstants.au3>

GUICreate("GUI with more treeviews",340,200,-1,-1,BitOr($WS_MINIMIZEBOX,$WS_MAXIMIZEBOX,$WS_GROUP,$WS_CAPTION,$WS_POPUP,$WS_SYSMENU))

$maintree = GUICtrlCreateTreeView (10,10,120,150)

$aboutitem = GUICtrlCreateTreeViewItem ("About",$maintree)

$generalitem = GUICtrlCreateTreeViewItem ("General",$maintree)

$toolsitem = GUICtrlCreateTreeViewItem ("Tools",$maintree)

$effectitem = GUICtrlCreateTreeViewItem ("Effects",$generalitem)

$styleitem = GUICtrlCreateTreeViewItem ("Styles",$generalitem)

$cmditem = GUICtrlCreateTreeViewItem ("Commandline",$toolsitem)

$miscitem = GUICtrlCreateTreeViewItem ("Misc",$toolsitem)

$descgroup = GUICtrlCreateGroup ("Description",140,105,180,55)

GUICtrlSetState (-1,$GUI_HIDE)

$effectsgroup = GUICtrlCreateGroup ("Effects",140,5,180,95)

GUICtrlSetState (-1,$GUI_HIDE)

$effectstree = GUICtrlCreateTreeView (150,20,160,70,BitOr($TVS_CHECKBOXES,$TVS_DISABLEDRAGDROP),$WS_EX_CLIENTEDGE)

GUICtrlSetState (-1,$GUI_HIDE)

$cancelbutton = GUICtrlCreateButton ("Cancel",130,170,70,20)

GUISetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = -3 Or $msg = -1 Or $msg = $cancelbutton

ExitLoop

EndSelect

WEnd

GUIDelete()

Exit

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

Hehee <_<

......btw tell me command for slecting treeview item pls, to select "General" item on button in this treeview...

#include <GUIConstants.au3>

GUICreate("GUI with more treeviews",340,200,-1,-1)

$maintree = GUICtrlCreateTreeView (10,10,120,150)

$aboutitem = GUICtrlCreateTreeViewItem ("About",$maintree)

$generalitem = GUICtrlCreateTreeViewItem ("General",$maintree)

$toolsitem = GUICtrlCreateTreeViewItem ("Tools",$maintree)

$effectitem = GUICtrlCreateTreeViewItem ("Effects",$generalitem)

$styleitem = GUICtrlCreateTreeViewItem ("Styles",$generalitem)

$cmditem = GUICtrlCreateTreeViewItem ("Commandline",$toolsitem)

$miscitem = GUICtrlCreateTreeViewItem ("Misc",$toolsitem)

$cancelbutton = GUICtrlCreateButton ("Cancel",130,170,70,20)

GUISetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = -3 Or $msg = -1 Or $msg = $cancelbutton

ExitLoop

EndSelect

WEnd

GUIDelete()

Exit

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

Gary gave you solution already. You are only blind <_<

@Gary: I will try to do some research probably tomorrow

@Zedna

give this a try and see if it fixes the external:

Func _GUICtrlTreeView_Create($hWnd, $iX, $iY, $iWidth = 150, $iHeight = 150, $iStyle = 0x00000037, $iExStyle = 0x00000000)
    If Not IsHWnd($hWnd) Then _WinAPI_ShowError ("Invalid Window handle for _GUICtrlTreeView_Create 1st parameter")
    
    Local $hTree
    
    If $iWidth = -1 Then $iWidth = 150
    If $iHeight = -1 Then $iHeight = 150
    If $iStyle = -1 Then $iStyle = 0x00000037
    If $iExStyle = -1 Then $iExStyle = 0x00000000

    ; =============================================================================================
    ; Might need this for Pre WinXP OS
    ; =============================================================================================
    Local Const $ICC_TREEVIEW_CLASSES = 0x2
    Local $stICCE = DllStructCreate('dword;dword')
    DllStructSetData($stICCE, 1, DllStructGetSize($stICCE))
    DllStructSetData($stICCE, 2, $ICC_TREEVIEW_CLASSES)
    DllCall('comctl32.dll', 'int', 'InitCommonControlsEx', 'ptr', DllStructGetPtr($stICCE))
    ; =============================================================================================

    $iStyle = BitOR($iStyle, $WS_CHILD, $WS_VISIBLE)
    $hTree = _WinAPI_CreateWindowEx ($iExStyle, "SysTreeView32", "", $iStyle, $iX, $iY, $iWidth, $iHeight, $hWnd)
    _WinAPI_SetFont ($hTree, _WinAPI_GetStockObject ($DEFAULT_GUI_FONT))
    _GUICtrlTreeView_SetUnicodeFormat($hTree, False)
    Return $hTree
EndFunc   ;==>_GUICtrlTreeView_Create

if it does then I suspect there will be a problem with most of the create's

Edited by GaryFrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Hey, is possible to make this but without button bug, see this:

#include <GUIConstants.au3>

GUICreate("GUI with more treeviews",340,200,-1,-1)

$maintree = GUICtrlCreateTreeView (10,10,120,150)

$aboutitem = GUICtrlCreateTreeViewItem ("About",$maintree)

$generalitem = GUICtrlCreateTreeViewItem ("General",$maintree)

$toolsitem = GUICtrlCreateTreeViewItem ("Tools",$maintree)

$effectitem = GUICtrlCreateTreeViewItem ("Effects",$maintree)

$styleitem = GUICtrlCreateTreeViewItem ("Styles",$maintree)

$cmditem = GUICtrlCreateTreeViewItem ("Commandline",$maintree)

$miscitem = GUICtrlCreateTreeViewItem ("Misc",$maintree)

$edit =GUICtrlCreateEdit("", 150, 44, 163, 20,$ES_AUTOHSCROLL)

GUICtrlCreateLabel("Type 'about' in edit",150,25,100,17)

$cancelbutton = GUICtrlCreateButton ("Cancel",130,170,70,20)

GUISetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = -3 Or $msg = -1 Or $msg = $cancelbutton

ExitLoop

EndSelect

$item = GUICtrlRead($edit)

If $item = "About" Then

GUICtrlCreateButton("Bugged Button:)", 150, 70, 81, 25, 0)

EndIf

WEnd

GUIDelete()

Exit

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

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...