Sign in to follow this  
Followers 0
Lmac34

Treeview HELP

8 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

OK here is some code that can be executed.

Regards

Lmac34

test.au3

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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"

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

the Error im getting is a _Mem_CtrlInit: Invalid Window Handle [0x\w[8]] \w[8] is some 8 char hex number which keeps changing.

it dose not appear when i use go, just when i use beta run.

Share this post


Link to post
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.

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