gcue Posted February 24, 2009 Share Posted February 24, 2009 Im able to expand the whole treeview but i want to just expand ONE parent.. ive tried using ($parent = the @ctrlid) _GUICtrlTreeView_Expand($treeview, $parent, True) Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 24, 2009 Share Posted February 24, 2009 Im able to expand the whole treeview but i want to just expand ONE parent.. ive tried using ($parent = the @ctrlid) _GUICtrlTreeView_Expand($treeview, $parent, True) There is nothing wrong with the code you posted, so the problem is elsewhere. This is the help file demo, simplified a little: #include <GuiConstantsEx.au3> #include <GuiTreeView.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Global $hItem[5], $hTreeView Global $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES) GUICreate("TreeView Expand", 400, 300) $hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE) For $x = 0 To 4 $hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView) For $y = 0 To 2 GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x]) Next Next GUISetState() MsgBox(4160, "Information", "Expand All") _GUICtrlTreeView_Expand($hTreeView) MsgBox(4160, "Information", "Collapse All") _GUICtrlTreeView_Expand($hTreeView, 0, False) MsgBox(4160, "Information", "Expand item 1") _GUICtrlTreeView_Expand($hTreeView, $hItem[1]) MsgBox(4160, "Information", "Collapse item 1") _GUICtrlTreeView_Expand($hTreeView, $hItem[1], False) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE That works fine. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
gcue Posted February 24, 2009 Author Share Posted February 24, 2009 (edited) hmm perhaps it has to do with the way i destroy and rebuild it? it does the expanding collapsing just fine after that though GUISwitch($MustHave_Edit_GUI) _GUICtrlTreeView_Destroy($treeview) BuildTree() _GUICtrlTreeView_Expand($treeview, 0, True) _GUICtrlTreeView_Expand($treeview, 0, False) _GUICtrlTreeView_Expand($treeview, $parent, True) Edited February 24, 2009 by gcue Link to comment Share on other sites More sharing options...
gcue Posted February 25, 2009 Author Share Posted February 25, 2009 duh - of course.. recreating treeview was gonna generate new control ids Link to comment Share on other sites More sharing options...
MichaelHan Posted April 24, 2009 Share Posted April 24, 2009 How could I just Expand one level of the tree, without expanding the whole tree under the parent. Link to comment Share on other sites More sharing options...
Zedna Posted April 24, 2009 Share Posted April 24, 2009 How could I just Expand one level of the tree, without expanding the whole tree under the parent.Look at sources"C:\Program Files\AutoIt3\Include\guitreeview.au3" _GUICtrlTreeView_Expand()_GUICtrlTreeView_ExpandItem() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
MichaelHan Posted April 27, 2009 Share Posted April 27, 2009 Look at sources"C:\Program Files\AutoIt3\Include\guitreeview.au3" _GUICtrlTreeView_Expand()_GUICtrlTreeView_ExpandItem()hi Zedna,Instead of using _GUICtrlTreeView_Expand(), I find the Item through the tree first, then expand it in the end.Thanks for your suggestion anyway.I have another query about how to get Item highlighted in the treeview so that the relevant info can be displayed on the other side of the window.Thanks Link to comment Share on other sites More sharing options...
Zedna Posted April 27, 2009 Share Posted April 27, 2009 (edited) Use GUIRegisterMsg() with WM_NOTIFY to catch TVN_SELCHANGED Search helpfile/forum for examples... Edited April 27, 2009 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted April 27, 2009 Share Posted April 27, 2009 I have another query about how to get Item highlighted in the treeview so that the relevant info can be displayed on the other side of the window.ThanksAlso look at_GUICtrlTreeView_GetSelection() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
MichaelHan Posted April 28, 2009 Share Posted April 28, 2009 Also look at_GUICtrlTreeView_GetSelection()Thanks Zedna.I use _GUICtrlTreeView_ClickItem() instead and It works fine.I'm stucked by the same item names in a treeview. I really wanna expand the second, but it will find the other one first. Any idea for this? They locates under the different child trees, but from the same root. Link to comment Share on other sites More sharing options...
matwachich Posted February 3, 2012 Share Posted February 3, 2012 Found the solution, while looking in the source of _GuiCtrlTreeView_ExpandItem: ; $hTreeView = Handle to your TreeView Control ; $hItem = Handle to your TreeView Item _SendMessage($hTreeView, $TVM_EXPAND, $TVE_EXPAND, $hItem, 0, "wparam", "handle") _SendMessage($hTreeView, $TVM_ENSUREVISIBLE, 0, $hItem, 0, "wparam", "handle") argumentum 1 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