AdmiralAlkex Posted September 19, 2010 Share Posted September 19, 2010 Run the example for _GUICtrlTreeView_DeleteChildren(), and after the deletion the plus-sign will still be there in front of the parent. I want the plus to disappear when there's no child (too confusing), any idea how to "fix" that? .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
smashly Posted September 20, 2010 Share Posted September 20, 2010 (edited) Hi as a nasty work around you could delete the parent and insert the parent again going by the exampleexpandcollapse popup#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiConstantsEx.au3> #include <GuiTreeView.au3> #include <GuiImageList.au3> #include <WindowsConstants.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 _Main() Func _Main() Local $hItem, $hImage, $iImage, $hTreeView, $sText, $iImageIndex Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES) GUICreate("TreeView Delete All", 400, 300) $hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE) GUISetState() $hImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon($hImage, "shell32.dll", 110) _GUIImageList_AddIcon($hImage, "shell32.dll", 131) _GUIImageList_AddIcon($hImage, "shell32.dll", 165) _GUIImageList_AddIcon($hImage, "shell32.dll", 168) _GUIImageList_AddIcon($hImage, "shell32.dll", 137) _GUIImageList_AddIcon($hImage, "shell32.dll", 146) _GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage) _GUICtrlTreeView_BeginUpdate($hTreeView) For $x = 1 To 2 $iImage = Random(0, 5, 1) $hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), $iImage, $iImage) For $y = 1 To 3 $iImage = Random(0, 5, 1) _GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y), $iImage, $iImage) Next Next _GUICtrlTreeView_EndUpdate($hTreeView) _GUICtrlTreeView_Expand($hTreeView) MsgBox(4160, "Information", "Delete Children") $sText = _GUICtrlTreeView_GetText($hTreeView, $hItem) $iImageIndex = _GUICtrlTreeView_GetImageIndex($hTreeView, $hItem) _GUICtrlTreeView_Delete($hTreeView, $hItem) _GUICtrlTreeView_InsertItem($hTreeView, $sText, 0, -1,$iImageIndex) ;_GUICtrlTreeView_DeleteChildren($hTreeView, $hItem) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_MainYou'd need to adjust the Insert Item params to suit your insertion spot. I know it defeats the idea of _GUICtrlTreeView_DeleteChildren(). I was looking for a SendMessage to delete a node button, but I'm not sure if or what it would be. Edited September 20, 2010 by smashly 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