Sign in to follow this  
Followers 0
WesW

TreeView Action

4 posts in this topic

What is the best way to do this... I am trying to click the app in the treeview and have it install. any suggestions?

#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <Constants.au3>
#include <StaticConstants.au3>

Opt('MouseCoordMode', 2)

Global $GUI, $hTreeView, $Context, $currentBtn = 0, $hGraphic, $hPen, $CurrentItem = ""

_Main()

Func _Main()
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

    ;Create Main UI
    $GUI = GUICreate("Automated Installs", 300, 404)

    ;Building the Treeview
    $hTreeView = _GUICtrlTreeView_Create($GUI, 2, 2, 296, 400, $iStyle, $WS_EX_CLIENTEDGE)
    _GUICtrlTreeView_BeginUpdate($hTreeView)
    $Parent = _GUICtrlTreeView_Add($hTreeView, 0, "Design and Engeeners Builds")
    _GUICtrlTreeView_AddChild($hTreeView, $Parent, "Designer build V8I 03.16.2011.exe")
    _GUICtrlTreeView_AddChild($hTreeView, $Parent, "Engineer Build 03.27.2011.exe")

     $Parent = _GUICtrlTreeView_Add($hTreeView, 0, "ProjectWise")
    _GUICtrlTreeView_AddChild($hTreeView, $Parent, "ProjectWise Build XP")
    _GUICtrlTreeView_AddChild($hTreeView, $Parent, "ProjectWsie Build Win 7" )

    _GUICtrlTreeView_EndUpdate($hTreeView)


    GUISetState(@SW_SHOW, $GUI)


    While 1

        $msg = GUIGetMsg()
        Switch $msg
            Case $GUI_EVENT_CLOSE
                Exit




        EndSwitch
    WEnd

EndFunc   ;==>_Main

Share this post


Link to post
Share on other sites



Time for a drink... Would anybody like to join me :)

Share this post


Link to post
Share on other sites

any suggestions?

Share this post


Link to post
Share on other sites

WesW,

So you have found absolutely nothing on how you might do this by searching the forum? :)

A couple of possibilities spring to mind:

- 1. If you want to select more than one option at a time, you can use the $TVS_CHECKBOXES style. Then you would need to loop through the TreeViewItems to see which were checked.

- 2. If you want just the one selection you can look for a double-click in a WM_NOTIFY handler - then you could use GUICtrlRead or _GUICtrlTreeView_GetTree to see what has been selected.

I hope that helps gets you going in the right direction. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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