Jump to content

Collapse parent tree of autoit help file > Contents

Recommended Posts

Hi @all,

I am new to autoIT. I am trying to collapse the parent tree of autoit help file as shown in the picture below. Should be an index of that tree is used so it can identify which will collapse?

EDIT: Or maybe Expand all? I know how to expand a tree in a "created GUI". But in a file such as this, I do not know...

#include <GUIConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

$file = FileGetShortName("C:\Users\PHSD100-SIC\Desktop\AutoIt3.chm")

RunWait(@ComSpec & " /c start " & $file)

$class_treeview = "[CLASS:SysTreeView32; INSTANCE:1]"

ControlTreeView('[CLASS:HH Parent]', '', '[CLASS:SysTreeView32; INSTANCE:1]', 'Collapse All', 0)
If @error Then
   MsgBox(4096, "Test", "Item not collapse", 10)


Edited by bazinguuh
Link to post
Share on other sites

I'm not that familiar with using ControlTreeView, but in the online help, there is no 'Collapse All', it is only 'Collapse', with perhaps an additional parameter needed?

You also have a parameter of '0' which seems inappropriate to me ... either leave that off altogether, or provide the appropriate item Header?? if required.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.


What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)


Link to post
Share on other sites


It's a bit more complicated than that. This code will do it.

#include <GuiTreeView.au3>

Global $hWnd = ControlGetHandle("[CLASS:HH Parent;TITLE:AutoIt Help]", "", "[CLASS:SysTreeView32; INSTANCE:1]")
Global $hChild = _GUICtrlTreeView_GetFirstChild($hWnd, 0)

While 1
    $hChild = _GUICtrlTreeView_GetNextChild($hWnd, $hChild)
    If _GUICtrlTreeView_GetText($hWnd, $hChild) = "Tutorials" Then ExitLoop

_GUICtrlTreeView_Expand(ControlGetHandle("[CLASS:HH Parent;TITLE:AutoIt Help]", "", "[CLASS:SysTreeView32; INSTANCE:1]"), $hChild, True)


THANKS. This works perfectly. However, I have another question: I have to select an item under the tree and double click it. Here is my code for selecting an item: or I could pass the items to array?

_GUICtrlTreeView_SelectItem( $hWnd, $hChild[3])
Edited by bazinguuh
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...