Sign in to follow this  
Followers 0
bazinguuh

Collapse parent tree of autoit help file > Contents

4 posts in this topic

#1 ·  Posted (edited)

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)
EndIf

post-80499-0-87316000-1371093740_thumb.p

Edited by bazinguuh

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

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

Spoiler

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)

userbar.png

Share this post


Link to post
Share on other sites

 

 

 

How about expanding only the TUTORIALS tree? I have tried this code but did not work:

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

 

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
    Sleep(10)
    $hChild = _GUICtrlTreeView_GetNextChild($hWnd, $hChild)
    If _GUICtrlTreeView_GetText($hWnd, $hChild) = "Tutorials" Then ExitLoop
WEnd

_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

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