Jump to content

Treeview HELP


Recommended Posts

Hi All

Im having some difficulty with This tree view.

i want to display a message box of all the nodes and there children

when ever i use local $hNode = _TreeView_FindNode($hWnd,$myJobs[$index]) ;$myJobs is an array of names that match all the parent nodes.

it returns 0;

$IMGTORUN = GUICtrlCreateTreeView(16, 376, 505, 249)
;
;
;
;   SOME OTHER CODE which has nothing to do with this
;
;
;
    local $index = 1
    local $amtchild = 0
    While($index <= $myJobs[0])
        Local $localLogs
        local $remoteLogs
        local $CustomerLogs
        Local $ProjectDir
        local $optcksum
        local $optExplode
        Local $optVC
        Local $optFileCmp
        local $hWnd = ControlGetHandle("GUI The Checker Version 3.0 no Client/Server","The Box Below shows ","SysTreeView321")
        local $hNode = _TreeView_FindNode($hWnd,$myJobs[$index])
        MsgBox(0,"Win Handle",$myJobs[$index] & ": "&$hNode)
        local $ChNode = _TreeView_GetFirstChild($IMGTORUN, $hNode)
;$localLogs = _TreeView_GetText($IMGTORUN,$ChNode)
        if $ChNode <> 0 then
            do
                Select
                Case $amtchild = 0
                    $localLogs = _TreeView_GetText($IMGTORUN,$ChNode)
                Case $amtchild = 1
                    $remoteLogs = _TreeView_GetText($IMGTORUN,$ChNode)
                Case $amtchild = 2
                    $CustomerLogs = _TreeView_GetText($IMGTORUN,$ChNode)
                Case $amtchild = 3
                    $ProjectDir = _TreeView_GetText($IMGTORUN,$ChNode)
                Case $amtchild = 4
                    $optcksum = _TreeView_GetText($IMGTORUN,$ChNode)
                Case $amtchild = 5
                    $optExplode = _TreeView_GetText($IMGTORUN,$ChNode)
                Case $amtchild = 6
                    $optVC = _TreeView_GetText($IMGTORUN,$ChNode)
                Case $amtchild = 7
                    $optFileCmp = _TreeView_GetText($IMGTORUN,$ChNode)
                EndSelect
                $amtchild = $amtchild + 1
                $ChNode   = _TreeView_GetNextChild($IMGTORUN, $ChNode)
            until $ChNode = 0
        endif
        MsgBox(0,"RESULTS",$localLogs & @CRLF & $remoteLogs & @CRLF & $CustomerLogs &@CRLF &$ProjectDir & @CRLF & $optcksum & @CRLF & $optExplode & @CRLF & $optVC & $optFileCmp)
        $index = $index + 1
    WEnd

Any Ideas or a solution would be great.

Regards

Lmac34

Edited by Lmac34
Link to comment
Share on other sites

Hi All

Im having some difficulty with This tree view.

i want to display a message box of all the nodes and there children

when ever i use local $hNode = _TreeView_FindNode($hWnd,$myJobs[$index]) ;$myJobs is an array of names that match all the parent nodes.

it returns 0;

$IMGTORUN = GUICtrlCreateTreeView(16, 376, 505, 249)
;
;
;
;   SOME OTHER CODE which has nothing to do with this
;
;
;
    local $index = 1
    local $amtchild = 0
    While($index <= $myJobs[0])
        Local $localLogs
        local $remoteLogs
        local $CustomerLogs
        Local $ProjectDir
        local $optcksum
        local $optExplode
        Local $optVC
        Local $optFileCmp
        local $hWnd = ControlGetHandle("GUI The Checker Version 3.0 no Client/Server","The Box Below shows ","SysTreeView321")
        local $hNode = _TreeView_FindNode($hWnd,$myJobs[$index])
        MsgBox(0,"Win Handle",$myJobs[$index] & ": "&$hNode)
        local $ChNode = _TreeView_GetFirstChild($IMGTORUN, $hNode)
;$localLogs = _TreeView_GetText($IMGTORUN,$ChNode)
        if $ChNode <> 0 then
            do
                Select
                Case $amtchild = 0
                    $localLogs = _TreeView_GetText($IMGTORUN,$ChNode)
                Case $amtchild = 1
                    $remoteLogs = _TreeView_GetText($IMGTORUN,$ChNode)
                Case $amtchild = 2
                    $CustomerLogs = _TreeView_GetText($IMGTORUN,$ChNode)
                Case $amtchild = 3
                    $ProjectDir = _TreeView_GetText($IMGTORUN,$ChNode)
                Case $amtchild = 4
                    $optcksum = _TreeView_GetText($IMGTORUN,$ChNode)
                Case $amtchild = 5
                    $optExplode = _TreeView_GetText($IMGTORUN,$ChNode)
                Case $amtchild = 6
                    $optVC = _TreeView_GetText($IMGTORUN,$ChNode)
                Case $amtchild = 7
                    $optFileCmp = _TreeView_GetText($IMGTORUN,$ChNode)
                EndSelect
                $amtchild = $amtchild + 1
                $ChNode   = _TreeView_GetNextChild($IMGTORUN, $ChNode)
            until $ChNode = 0
        endif
        MsgBox(0,"RESULTS",$localLogs & @CRLF & $remoteLogs & @CRLF & $CustomerLogs &@CRLF &$ProjectDir & @CRLF & $optcksum & @CRLF & $optExplode & @CRLF & $optVC & $optFileCmp)
        $index = $index + 1
    WEnd

Any Ideas or a solution would be great.

Regards

Lmac34

It would be better if you posted some code that we could run.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

You get the control handle wrong.

Replace

local $hWnd = ControlGetHandle("TREEVIEW TEST","","SysTreeView32") ;that's incorrect syntax

with

local $hWnd = ControlGetHandle("TREEVIEW TEST","","[CLASS:SysTreeView32]")

or

local $hWnd = ControlGetHandle($Form1,"",$TreeView1)

Edited by Siao

"be smart, drink your wine"

Link to comment
Share on other sites

In Function StartMSGBOX() change this line:

local $hWnd = ControlGetHandle("TREEVIEW TEST","","SysTreeView32")

for this one

local $hWnd = GUICtrlGetHandle($TreeView1)

For some reason ControlGetHandle() is not returning any value.

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

Hi all Thanks Every one

that seems to do the trick i also noticed a problem with Scite version 1.71

it will not obtain the winhandles in beta run Alt+F5

but if you use go i.e. "F5" it will, just for future Referrence.

Regards

Lmac34.

Thanks Once Again Everyone.

Link to comment
Share on other sites

You get the control handle wrong.

Replace

local $hWnd = ControlGetHandle("TREEVIEW TEST","","SysTreeView32") ;that's incorrect syntax

with

local $hWnd = ControlGetHandle("TREEVIEW TEST","","[CLASS:SysTreeView32]")

or

local $hWnd = ControlGetHandle($Form1,"",$TreeView1)

...

For some reason ControlGetHandle() is not returning any value.

While the proposed solution works, the ONLY thing actually wrong with your original syntax is that you did not specify an "instance" of your TreeView control.

Thats why ControlGetHandle is not returning any value.

So replace:

local $hWnd = ControlGetHandle("TREEVIEW TEST","",SysTreeView32")

with

local $hWnd = ControlGetHandle("TREEVIEW TEST","",SysTreeView321")

the 1 refering to the 1st instance or occurrence of the control in question. If you had 2 Listviews, the 2nd one would be Systreeview322, etc.

From a logistical standpoint the "local $hWnd = ControlGetHandle($Form1,"",$TreeView1)" is probably the best option as it helps you know for sure which of your controls you're referencing, but in a window you didn't create, you will need to specify the "instance" of the control to make sure your accessing the right one.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...