Jump to content
Sign in to follow this  
galpha

TreeView always expended

Recommended Posts

galpha

How can I make that when I execute the program, the 2nd level in the treeview automaticly shows but i can still have the buttons with a (-) sign incase i want to minimioze it. I'd like only level 2 incase I want a 3rd level. Here's an exemple script I found, where do I need to modify it?

Also, is it possible to only have the 1st level of the tree with checkboxes and not the other levels

#include <GUIConstants.au3>;this is required for a GUI to work
;~ #include "SearchIE.au3"

;This creates the inital GUI box
;To Remove any non-needed checkboxes simply remark any of the CHKBOX lines
GUICreate ("EZ Duc",580,400)
GUISetFont(14,600)

; PIC
GuiCtrlCreatePic("Logo.jpg",50,10,167,74)
;GuiCtrlCreateLabel("Sample pic", 75, 1, 53, 15)
GuiCtrlSetColor(-1,0xffffff)

;Lable
GUICtrlCreateLabel("Application Installer",240,20)
GUICtrlCreateLabel("From folder",235,50)
GUISetFont(9,400)
;TreeView
$treeview = GUICtrlCreateTreeView(30, 80, 520, 250, BitOr($TVS_CHECKBOXES, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
$generalitem    = GUICtrlCreateTreeViewitem("General", $treeview)
GUICtrlSetColor(-1, 0x0000C0)
$displayitem    = GUICtrlCreateTreeViewitem("Display", $treeview)
GUICtrlSetColor(-1, 0x0000C0)

$APP1_CHKBOX = GUICtrlCreateTreeViewitem("Winrar", $generalitem)
$APP2_CHKBOX = GUICtrlCreateTreeViewitem("Firefox", $generalitem);Checkbox 2
$APP3_CHKBOX = GUICtrlCreateTreeViewitem("Vim", $generalitem);Checkbox 3
$APP4_CHKBOX = GUICtrlCreateTreeViewitem("VLC", $generalitem);Checkbox 4
$APP5_CHKBOX = GUICtrlCreateTreeViewitem("Notepad ++", $generalitem);Checkbox 5

$RUN = GUICtrlCreateButton("Calculer",10,350,120,20);This in the Run button
$EXIT = GUICtrlCreateButton("Quitter",450,350,120,20);This causes the application to exit
GUISetState()

While 1
   $msg = GUIGetMsg()
   Select
       Case $msg = $GUI_EVENT_CLOSE Or $msg = $EXIT
         Exit
      Case $msg = $RUN
         Install()
   EndSelect
WEnd
Exit

Func IsChecked($control)
    Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED
EndFunc

Func Install()
  ;Checks the status of the Checkboxes and calls the application function(s) if the checkbox is enabled
    IF IsChecked($APP1_CHKBOX) then APP_1()
    IF IsChecked($APP2_CHKBOX) then APP_2()
    IF IsChecked($APP3_CHKBOX) then APP_3()
    IF IsChecked($APP4_CHKBOX) then APP_4()
    IF IsChecked($APP5_CHKBOX) then APP_5()
      MsgBox(4096,"Complete","All Selected Applications Installed")
    Exit
EndFunc

;Add Application Functions here
Func APP_1();Function for application 1
       MsgBox(4096,"wrar370.exe","Installs Winrar")
    RunWait("wrar370.exe /S")
EndFunc

Func APP_2();Function for application 2
    MsgBox(4096,"Firefox Setup 2.0.0.5.exe","Firefox")
    RunWait("Firefox Setup 2.0.0.5.exe")
EndFunc

Func APP_3();Function for application 3
    MsgBox(4096,"gvim71.exe","Vim")
    RunWait("gvim71.exe")
EndFunc

Func APP_4();Function for application 4
    MsgBox(4096,"vlc-0.8.6c-win32.exe","Vlc Player")
    RunWait("vlc-0.8.6c-win32.exe")
EndFunc

Func APP_5();Function for application 5
    MsgBox(4096,"npp.4.2.2.Installer.exe","This is where Application 5 would run")
    RunWait("npp.4.2.2.Installer.exe")
EndFunc
Edited by galpha

Share this post


Link to post
Share on other sites
ReFran

Look at

Func _TreeView_Expand($hWnd, $hNode, $fRecurse=False)

in Auto3Library

With Auto3Lib you have more options, but also more to learn and there is no further development (if I understand all right).

So I would use the standard UDF:

_GUICtrlTreeViewExpand ( $i_treeview [, $i_expand = 1 [, $h_itemID = 0 ]] )

See help file for examples. Don't forget to set the include: #include <GuiTreeView.au3>

However, if you want to work with Auto3Lib you first have to get the handle to your treeview created with standard GUICtrlCreateTreeView.

HTH, Reinhard

Share this post


Link to post
Share on other sites
galpha

Thanks a lot, it works

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  

×