Lmac34 Posted July 2, 2007 Share Posted July 2, 2007 (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; expandcollapse popup$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 July 2, 2007 by Lmac34 Link to comment Share on other sites More sharing options...
martin Posted July 2, 2007 Share Posted July 2, 2007 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; expandcollapse popup$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 More sharing options...
Lmac34 Posted July 3, 2007 Author Share Posted July 3, 2007 OK here is some code that can be executed. Regards Lmac34test.au3 Link to comment Share on other sites More sharing options...
Siao Posted July 3, 2007 Share Posted July 3, 2007 (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 July 3, 2007 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
Danny35d Posted July 3, 2007 Share Posted July 3, 2007 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 More sharing options...
Lmac34 Posted July 3, 2007 Author Share Posted July 3, 2007 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 More sharing options...
Lmac34 Posted July 3, 2007 Author Share Posted July 3, 2007 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. Link to comment Share on other sites More sharing options...
ResNullius Posted July 3, 2007 Share Posted July 3, 2007 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now