PaulIA Posted April 6, 2007 Author Posted April 6, 2007 Hello! I try to run an example from the auto3lib manual and everytime i get error message:-------------------------------------Line 124 (File "C:\Program Files\AutoIt3\Include\A3LListbox.au3"):$tBuffer.Text = $sText$tBuffer^ERRORError: Variable must be of type "Object"--------------------------------------What is wrong here?Welcome to the forum. You need the latest beta version of AutoIt that includes the new structure changes. Auto3Lib: A library of over 1200 functions for AutoIt
lsakizada Posted April 6, 2007 Posted April 6, 2007 Paul, How do I get the node handle by using the click mouse (left click). ? The example "TreeView 1.au3" show how to handle right click but not how to get it by left click. Can you please show me how do you do that with "TreeView 1.au3"? Thanks !!! Be Green Now or Never (BGNN)!
perrin_goldeneyes Posted April 6, 2007 Posted April 6, 2007 I'm here so I can answer to you quicker than PaulIA:You must use latest beta version of AutoIt.Ok, thanks, I no longer get the error
PaulIA Posted April 6, 2007 Author Posted April 6, 2007 (edited) Paul,How do I get the node handle by using the click mouse (left click). ?The example "TreeView 1.au3" show how to handle right click but not how to get it by left click.Can you please show me how do you do that with "TreeView 1.au3"? Thanks !!!There's a couple of ways to do this:1. In the loop where I wait for the $GUI_EVENT_CLOSE message, look for $GUI_EVENT_PRIMARYDOWN too which tells you the primary mouse button was pressed. Then use _TreeView_GetSelection to return the currently selected node.2. Use GUIRegisterMessage and register the $TVN_SELCHANGED message. This message is sent by the TreeView when the selection changes from one node to another. When you receive this message, use _TreeView_GetSelection to return the currently selected node. If you go this route, you need to comment out the line that registers the $WM_NOTIFY message.I'll leave the coding to you as an exercise. Just use TreeView 1 as your guide and if you get stuck, let me know. Edited April 6, 2007 by PaulIA Auto3Lib: A library of over 1200 functions for AutoIt
lsakizada Posted April 8, 2007 Posted April 8, 2007 (edited) There's a couple of ways to do this:1. In the loop where I wait for the $GUI_EVENT_CLOSE message, look for $GUI_EVENT_PRIMARYDOWN too which tells you the primary mouse button was pressed. Then use _TreeView_GetSelection to return the currently selected node.2. Use GUIRegisterMessage and register the $TVN_SELCHANGED message. This message is sent by the TreeView when the selection changes from one node to another. When you receive this message, use _TreeView_GetSelection to return the currently selected node. If you go this route, you need to comment out the line that registers the $WM_NOTIFY message.I'll leave the coding to you as an exercise. Just use TreeView 1 as your guide and if you get stuck, let me know.Paul, I have succeded to run the first option but it is not good solution for me. It is not since when I click on the toolbar command buttons it is clicked on the selected node tree as well..the $GUI_EVENT_PRIMARYDOWN works for both of them and I did not find solution for it.(BTW: I merged the "TreeView 1.au3" and "Tolbar 1.au3").I have tried solution number two without much successful. I would be happy to get help on it.I was not able to get the node handle without using $WM_NOTIFY. Edited April 8, 2007 by lsakizada Be Green Now or Never (BGNN)!
PaulIA Posted April 8, 2007 Author Posted April 8, 2007 Paul, I have succeded to run the first option but it is not good solution for me. It is not since when I click on the toolbar command buttons it is clicked on the selected node tree as well..the $GUI_EVENT_PRIMARYDOWN works for both of them and I did not find solution for it. (BTW: I merged the "TreeView 1.au3" and "Tolbar 1.au3"). I have tried solution number two without much successful. I would be happy to get help on it.I was not able to get the node handle without using $WM_NOTIFY.I must have been asleep when I answered this before. The $TVN_SELCHANGED message is sent via $WM_NOTIFY. What I SHOULD have said, is change the WM_NOTIFY handler to trap this message (not delete it). Here's a short piece of code to show you what you need to do. I will include the structure definition in the next release. CODEexpandcollapse popup#include <A3LTreeView.au3> Opt("MustDeclareVars", 1) ; #STRUCTURE# ================================================================================ ; Description ...: tagNMTREEVIEW structure ; Fields ........: WndFrom - Window handle to the control sending a message ; IDFrom - Identifier of the control sending a message ; Code - Notification code ; Action - Notification-specific action flag ; OldMask - Flags that indicate which of the other structure members contain valid data. ; OldhItem - Item to which this structure refers ; OldState - Set of bit flags and image list indexes that indicate the item's state ; OldStateMask - Bits of the state member that are valid ; OldText - Pointer to a null-terminated string that contains the item text. ; OldTextMax - Size of the buffer pointed to by the Text member, in characters ; OldImage - Index in the image list of the icon image to use when the item is in the nonselected state ; OldSelectedImage - Index in the image list of the icon image to use when the item is in the selected state ; OldChildren - Flag that indicates whether the item has associated child items ; OldParam - A value to associate with the item ; NewMask - Flags that indicate which of the other structure members contain valid data. ; NewhItem - Item to which this structure refers ; NewState - Set of bit flags and image list indexes that indicate the item's state ; NewStateMask - Bits of the state member that are valid ; NewText - Pointer to a null-terminated string that contains the item text. ; NewTextMax - Size of the buffer pointed to by the Text member, in characters ; NewImage - Index in the image list of the icon image to use when the item is in the nonselected state ; NewSelectedImage - Index in the image list of the icon image to use when the item is in the selected state ; NewChildren - Flag that indicates whether the item has associated child items ; NewParam - A value to associate with the item ; PointX - X position that of the mouse at the time the event occurred ; PointY - Y position that of the mouse at the time the event occurred ; Author ........: Paul Campbell (PaulIA) ; Remarks .......: ; ========================================================================================= Global Const $tagNMTREEVIEW = "int WndFrom;int IDFrom;int Code;int Action;int OldMask;int OldhItem;int OldState;int OldStateMask;" & _ "ptr OldText;int OldTextMax;int OldImage;int OldSelectedImage;int OldChildren;int OldParam;int NewMask;int NewhItem;" & _ "int NewState;int NewStateMask;ptr NewText;int NewTextMax;int NewImage;int NewSelectedImage;int NewChildren;" & _ "int NewParam;int PointX; int PointY" ; Global variables Global $hGUI, $hTree, $hNode[7] ; Create TreeView $hGUI = GUICreate("TreeView Test GUI", 408, 300, -1, -1, $WS_SIZEBOX) $hTree = _TreeView_Create($hGUI, 2, 2, 404, 270, BitOR($TVS_DEFAULT, $TVS_CHECKBOXES)) GUISetState() ; Add some nodes $hNode[1] = _TreeView_Add($hTree, 0, "Node 1") $hNode[2] = _TreeView_AddChild($hTree, $hNode[1], "Node 2") $hNode[3] = _TreeView_AddChild($hTree, $hNode[2], "Node 3") $hNode[4] = _TreeView_Add($hTree, 0, "Node 4") $hNode[5] = _TreeView_AddChild($hTree, $hNode[4], "Node 5") $hNode[6] = _TreeView_AddChild($hTree, $hNode[4], "Node 6") ; Register command handler GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; Loop until user exits do until GUIGetMsg() = $GUI_EVENT_CLOSE ; Handle WM_NOTIFY messages Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $tInfo, $sOldText, $sNewText $tInfo = DllStructCreate($tagNMTREEVIEW, $ilParam) if $tInfo.Code = $TVN_SELCHANGED then if $tInfo.OldhItem <> 0 then $sOldText = _TreeView_GetText($hTree, $tInfo.OldhItem) _Lib_ConsoleWrite("Old item: 0x" & Hex($tInfo.OldhItem) & " Text: " & $sOldText) endif if $tInfo.NewhItem <> 0 then $sNewText = _TreeView_GetText($hTree, $tInfo.NewhItem) _Lib_ConsoleWrite("New item: 0x" & Hex($tInfo.NewhItem) & " Text: " & $sNewText) endif _Lib_ConsoleWrite() endif Return $GUI_RUNDEFMSG EndFunc Auto3Lib: A library of over 1200 functions for AutoIt
lsakizada Posted April 8, 2007 Posted April 8, 2007 I must have been asleep when I answered this before. The $TVN_SELCHANGED message is sent via $WM_NOTIFY. What I SHOULD have said, is change the WM_NOTIFY handler to trap this message (not delete it). Here's a short piece of code to show you what you need to do. I will include the structure definition in the next release. CODEexpandcollapse popup#include <A3LTreeView.au3> Opt("MustDeclareVars", 1) ; #STRUCTURE# ================================================================================ ; Description ...: tagNMTREEVIEW structure ; Fields ........: WndFrom - Window handle to the control sending a message ; IDFrom - Identifier of the control sending a message ; Code - Notification code ; Action - Notification-specific action flag ; OldMask - Flags that indicate which of the other structure members contain valid data. ; OldhItem - Item to which this structure refers ; OldState - Set of bit flags and image list indexes that indicate the item's state ; OldStateMask - Bits of the state member that are valid ; OldText - Pointer to a null-terminated string that contains the item text. ; OldTextMax - Size of the buffer pointed to by the Text member, in characters ; OldImage - Index in the image list of the icon image to use when the item is in the nonselected state ; OldSelectedImage - Index in the image list of the icon image to use when the item is in the selected state ; OldChildren - Flag that indicates whether the item has associated child items ; OldParam - A value to associate with the item ; NewMask - Flags that indicate which of the other structure members contain valid data. ; NewhItem - Item to which this structure refers ; NewState - Set of bit flags and image list indexes that indicate the item's state ; NewStateMask - Bits of the state member that are valid ; NewText - Pointer to a null-terminated string that contains the item text. ; NewTextMax - Size of the buffer pointed to by the Text member, in characters ; NewImage - Index in the image list of the icon image to use when the item is in the nonselected state ; NewSelectedImage - Index in the image list of the icon image to use when the item is in the selected state ; NewChildren - Flag that indicates whether the item has associated child items ; NewParam - A value to associate with the item ; PointX - X position that of the mouse at the time the event occurred ; PointY - Y position that of the mouse at the time the event occurred ; Author ........: Paul Campbell (PaulIA) ; Remarks .......: ; ========================================================================================= Global Const $tagNMTREEVIEW = "int WndFrom;int IDFrom;int Code;int Action;int OldMask;int OldhItem;int OldState;int OldStateMask;" & _ "ptr OldText;int OldTextMax;int OldImage;int OldSelectedImage;int OldChildren;int OldParam;int NewMask;int NewhItem;" & _ "int NewState;int NewStateMask;ptr NewText;int NewTextMax;int NewImage;int NewSelectedImage;int NewChildren;" & _ "int NewParam;int PointX; int PointY" ; Global variables Global $hGUI, $hTree, $hNode[7] ; Create TreeView $hGUI = GUICreate("TreeView Test GUI", 408, 300, -1, -1, $WS_SIZEBOX) $hTree = _TreeView_Create($hGUI, 2, 2, 404, 270, BitOR($TVS_DEFAULT, $TVS_CHECKBOXES)) GUISetState() ; Add some nodes $hNode[1] = _TreeView_Add($hTree, 0, "Node 1") $hNode[2] = _TreeView_AddChild($hTree, $hNode[1], "Node 2") $hNode[3] = _TreeView_AddChild($hTree, $hNode[2], "Node 3") $hNode[4] = _TreeView_Add($hTree, 0, "Node 4") $hNode[5] = _TreeView_AddChild($hTree, $hNode[4], "Node 5") $hNode[6] = _TreeView_AddChild($hTree, $hNode[4], "Node 6") ; Register command handler GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; Loop until user exits do until GUIGetMsg() = $GUI_EVENT_CLOSE ; Handle WM_NOTIFY messages Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $tInfo, $sOldText, $sNewText $tInfo = DllStructCreate($tagNMTREEVIEW, $ilParam) if $tInfo.Code = $TVN_SELCHANGED then if $tInfo.OldhItem <> 0 then $sOldText = _TreeView_GetText($hTree, $tInfo.OldhItem) _Lib_ConsoleWrite("Old item: 0x" & Hex($tInfo.OldhItem) & " Text: " & $sOldText) endif if $tInfo.NewhItem <> 0 then $sNewText = _TreeView_GetText($hTree, $tInfo.NewhItem) _Lib_ConsoleWrite("New item: 0x" & Hex($tInfo.NewhItem) & " Text: " & $sNewText) endif _Lib_ConsoleWrite() endif Return $GUI_RUNDEFMSG EndFunc Paul, Something is wrong with the string ($tagNMTREEVIEW ) that create the struct. I am getting error # 2. What's wrong? Be Green Now or Never (BGNN)!
PaulIA Posted April 8, 2007 Author Posted April 8, 2007 (edited) Paul, Something is wrong with the string ($tagNMTREEVIEW ) that create the struct. I am getting error # 2.What's wrong?Error 2 means that the data type isn't valid. Are you sure you didn't mess up the code when you copied it from the forum? Do you have the latest beta version of AutoIt? Edited April 8, 2007 by PaulIA Auto3Lib: A library of over 1200 functions for AutoIt
JackyMB Posted April 8, 2007 Posted April 8, 2007 Hi,I'm using Windows XP Pro SP2, AutoIt 3.2.2.0, Scite 1.72 and the Auto3Lib dated 04/04/2007I test Header control with listing in help file and i receive this message :C:\ZJMBOU~1\_Dev\_AutoIt3\AutoIt3\Include\A3LWinAPI.au3 (990) : ==> AutoIt has encountered a fatal crash as a result of: Unable to execute DLLCall.: $aResult = DllCall("Kernel32.dll", "int", "FormatMessageA", "int", $iFlags, "hwnd", $pSource, "int", $iMessageID, "int", $iLanguageID, "ptr", $pBuffer, "int", $iSize, "ptr", $vArguments) Help Me !Excuse my english, i'm frenchBest regards
PaulIA Posted April 8, 2007 Author Posted April 8, 2007 (edited) Hi,I'm using Windows XP Pro SP2, AutoIt 3.2.2.0, Scite 1.72 and the Auto3Lib dated 04/04/2007I test Header control with listing in help file and i receive this message :C:\ZJMBOU~1\_Dev\_AutoIt3\AutoIt3\Include\A3LWinAPI.au3 (990) : ==> AutoIt has encountered a fatal crash as a result of: Unable to execute DLLCall.: $aResult = DllCall("Kernel32.dll", "int", "FormatMessageA", "int", $iFlags, "hwnd", $pSource, "int", $iMessageID, "int", $iLanguageID, "ptr", $pBuffer, "int", $iSize, "ptr", $vArguments) Help Me !Excuse my english, i'm frenchBest regardsBienvenue au forum! (Pardon my French) First, check to make sure you have the latest beta version of AutoIt installed. Next, make sure that when you installed Auto3Lib, that you deleted any old A3L*.au3 files from the include folder. Then, if the problem still exists, tell me which example in the help file that you are getting this error on. Edited April 8, 2007 by PaulIA Auto3Lib: A library of over 1200 functions for AutoIt
JackyMB Posted April 8, 2007 Posted April 8, 2007 Bienvenue au forum! (Pardon my French) First, check to make sure you have the latest beta version of AutoIt installed. Next, make sure that when you installed Auto3Lib, that you deleted any old A3L*.au3 files from the include folder. Then, if the problem still exists, tell me which example in the help file that you are getting this error on.I remove AutoLib from AutoIT versionI installaed last beta v3.2.3.2I re-installed AutoLib in beta version directoryRun in beta version = is OK Thank You PaulIA
lsakizada Posted April 9, 2007 Posted April 9, 2007 Error 2 means that the data type isn't valid. Are you sure you didn't mess up the code when you copied it from the forum? Do you have the latest beta version of AutoIt?It was my beta synchronization problem Thank you Be Green Now or Never (BGNN)!
lsakizada Posted April 9, 2007 Posted April 9, 2007 (edited) Paul, How do I create clientedge style for the TreeView control. Something like $WS_EX_CLIENTEDGE in Autoit3? Thanks Edited April 9, 2007 by lsakizada Be Green Now or Never (BGNN)!
tinjaw Posted April 9, 2007 Posted April 9, 2007 I had a working script Friday, but today I updated Auto3Lib using the new installer and the script now throws an error. >Running:(3.2.2.0):D:\chaim\AutoIt3\autoit3.exe "D:\workspace\Lion8MapMerge\Lion8MapMerge.au3" D:\chaim\AutoIt3\Include\A3LWinAPI.au3 (1775) : ==> AutoIt has encountered a fatal crash as a result of: Unable to execute DLLCall.: DllCall("User32.dll", "int", "GetWindowRect", "hwnd", $hWnd, "ptr", DllStructGetPtr($tRect)) I did a: del a3l*.au3 in the include directory and then reran the installer and chose "repair" and the problem remains. I'll try to debug on my side, but can you take a quick look at this issue and see if you can come up with something?
PaulIA Posted April 9, 2007 Author Posted April 9, 2007 I had a working script Friday, but today I updated Auto3Lib using the new installer and the script now throws an error. >Running:(3.2.2.0):D:\chaim\AutoIt3\autoit3.exe "D:\workspace\Lion8MapMerge\Lion8MapMerge.au3" D:\chaim\AutoIt3\Include\A3LWinAPI.au3 (1775) : ==> AutoIt has encountered a fatal crash as a result of: Unable to execute DLLCall.: DllCall("User32.dll", "int", "GetWindowRect", "hwnd", $hWnd, "ptr", DllStructGetPtr($tRect)) I did a: del a3l*.au3 in the include directory and then reran the installer and chose "repair" and the problem remains. I'll try to debug on my side, but can you take a quick look at this issue and see if you can come up with something?The only problem people have had is not using the latest beta version of AutoIt. Auto3Lib: A library of over 1200 functions for AutoIt
PaulIA Posted April 9, 2007 Author Posted April 9, 2007 Paul,How do I create clientedge style for the TreeView control. Something like $WS_EX_CLIENTEDGE in Autoit3?ThanksI'll add this capability to the next release, which should be later today or tomorrow depending on how long it takes to finish the regression testing. Auto3Lib: A library of over 1200 functions for AutoIt
tinjaw Posted April 9, 2007 Posted April 9, 2007 The only problem people have had is not using the latest beta version of AutoIt.That's it! PEBCAK I overlooked that that was a requirement. Where can I get the old version of Auto3Lib as I am not using the Beta version of AutoIt?
PaulIA Posted April 9, 2007 Author Posted April 9, 2007 That's it! PEBCAK I overlooked that that was a requirement. Where can I get the old version of Auto3Lib as I am not using the Beta version of AutoIt?I don't keep the old versions. You're better off just installing the beta version of AutoIt. I haven't found any problems with it yet and you'll get all the Auto3Lib bug fixes that way. Auto3Lib: A library of over 1200 functions for AutoIt
Zedna Posted April 9, 2007 Posted April 9, 2007 I don't keep the old versions. You're better off just installing the beta version of AutoIt. I haven't found any problems with it yet and you'll get all the Auto3Lib bug fixes that way.I have all old versions. So if somebody want, just send me PM.But as PaulIA said best way is to use latest beta of AutoIt and latest version of Auto3Lib Resources UDF ResourcesEx UDF AutoIt Forum Search
tinjaw Posted April 10, 2007 Posted April 10, 2007 I don't keep the old versions. You're better off just installing the beta version of AutoIt. I haven't found any problems with it yet and you'll get all the Auto3Lib bug fixes that way.I will take Zedna up on the offer to get the older version and I will also install the Beta version of AutoIt to a separate folder and start to migrate my projects over as time allows.thanx,tinjaw
Recommended Posts