syno Posted December 27, 2008 Share Posted December 27, 2008 Hi guys I have just started using Autoit and was wondering if anybody can point me in the right direction here. I have a Tree View using the following control: GUICtrlCreateTreeView. I want to list some files using the Tree View but then open those files when i double click one of the tree view items.. Any help would be greatly appreciated. Thanks Link to comment Share on other sites More sharing options...
Zedna Posted December 28, 2008 Share Posted December 28, 2008 GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") and catch $NM_DBLCLK event Example from helpfile for _GUICtrlTreeView_Create() expandcollapse popup#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiConstantsEx.au3> #include <GuiTreeView.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) $Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work Global $hTreeView _Main() Func _Main() Local $GUI, $hItem Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES) $GUI = GUICreate("(UDF Created) TreeView Create", 400, 300) $hTreeView = _GUICtrlTreeView_Create($GUI, 2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") _GUICtrlTreeView_BeginUpdate($hTreeView) For $x = 1 To Random(2, 10, 1) $hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x)) For $y = 1 To Random(2, 10, 1) _GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y)) Next Next _GUICtrlTreeView_EndUpdate($hTreeView) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview $hWndTreeview = $hTreeView If Not IsHWnd($hTreeView) Then $hWndTreeview = GUICtrlGetHandle($hTreeView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTreeview Switch $iCode Case $NM_CLICK ; The user has clicked the left mouse button within the control _DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ;~ Return 1 ; nonzero to not allow the default processing Return 0 ; zero to allow the default processing Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control _DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ;~ Return 1 ; nonzero to not allow the default processing Return 0 ; zero to allow the default processing Case $NM_RCLICK ; The user has clicked the right mouse button within the control _DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ;~ Return 1 ; nonzero to not allow the default processing Return 0 ; zero to allow the default processing Case $NM_RDBLCLK ; The user has clicked the right mouse button within the control _DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ;~ Return 1 ; nonzero to not allow the default processing Return 0 ; zero to allow the default processing Case $NM_KILLFOCUS ; control has lost the input focus _DebugPrint("$NM_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; No return value Case $NM_RETURN ; control has the input focus and that the user has pressed the key _DebugPrint("$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ;~ Return 1 ; nonzero to not allow the default processing Return 0 ; zero to allow the default processing ;~ Case $NM_SETCURSOR ; control is setting the cursor in response to a WM_SETCURSOR message ;~ Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam) ;~ $hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom")) ;~ $iIDFrom = DllStructGetData($tinfo, "IDFrom") ;~ $iCode = DllStructGetData($tinfo, "Code") ;~ _DebugPrint("$NM_SETCURSOR" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ ;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ ;~ "-->Code:" & @TAB & $iCode & @LF & _ ;~ "-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _ ;~ "-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _ ;~ "-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _ ;~ "-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _ ;~ "-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo")) ;~ Return 0 ; to enable the control to set the cursor ;~ Return 1 ; nonzero to prevent the control from setting the cursor Case $NM_SETFOCUS ; control has received the input focus _DebugPrint("$NM_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; No return value Case $TVN_BEGINDRAG, $TVN_BEGINDRAGW _DebugPrint("$TVN_BEGINDRAG") Case $TVN_BEGINLABELEDIT, $TVN_BEGINLABELEDITW _DebugPrint("$TVN_BEGINLABELEDIT") Case $TVN_BEGINRDRAG, $TVN_BEGINRDRAGW _DebugPrint("$TVN_BEGINRDRAG") Case $TVN_DELETEITEM, $TVN_DELETEITEMW _DebugPrint("$TVN_DELETEITEM") Case $TVN_ENDLABELEDIT, $TVN_ENDLABELEDITW _DebugPrint("$TVN_ENDLABELEDIT") Case $TVN_GETDISPINFO, $TVN_GETDISPINFOW _DebugPrint("$TVN_GETDISPINFO") Case $TVN_GETINFOTIP, $TVN_GETINFOTIPW _DebugPrint("$TVN_GETINFOTIP") Case $TVN_ITEMEXPANDED, $TVN_ITEMEXPANDEDW _DebugPrint("$TVN_ITEMEXPANDED") Case $TVN_ITEMEXPANDING, $TVN_ITEMEXPANDINGW _DebugPrint("$TVN_ITEMEXPANDING") Case $TVN_KEYDOWN _DebugPrint("$TVN_KEYDOWN") Case $TVN_SELCHANGED, $TVN_SELCHANGEDW _DebugPrint("$TVN_SELCHANGED") Case $TVN_SELCHANGING, $TVN_SELCHANGINGW _DebugPrint("$TVN_SELCHANGING") Case $TVN_SETDISPINFO, $TVN_SETDISPINFOW _DebugPrint("$TVN_SETDISPINFO") Case $TVN_SINGLEEXPAND _DebugPrint("$TVN_SINGLEEXPAND") EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _DebugPrint($s_text, $line = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @LF & _ "+======================================================" & @LF & _ "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _ "+======================================================" & @LF) EndFunc ;==>_DebugPrint Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
rasim Posted December 28, 2008 Share Posted December 28, 2008 @synoExample:expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiTreeView.au3> #include <File.au3> $Style = BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS) $hGUI = GUICreate("Test", 300, 300) $cTreeView = GUICtrlCreateTreeView(10, 10, 280, 280, $Style) $hTreeView = GUICtrlGetHandle($cTreeView) $cTreeView_MainItem = GUICtrlCreateTreeViewItem("Files", $cTreeView) Dim $aFiles = _FileListToArray(@ProgramFilesDir & "\AutoIt3\Examples", "*.au3", 1) For $i = 1 To $aFiles[0] GUICtrlCreateTreeViewItem($aFiles[$i], $cTreeView_MainItem) Next GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $tNMHDR, $hWndFrom, $iCode $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hTreeView Switch $iCode Case $NM_DBLCLK Local $tPOINT = DllStructCreate("int X;int Y") DllStructSetData($tPOINT, "X", MouseGetPos(0)) DllStructSetData($tPOINT, "Y", MouseGetPos(1)) _ScreenToClient($hTreeView, $tPOINT) Local $iX = DllStructGetData($tPOINT, "X") Local $iY = DllStructGetData($tPOINT, "Y") Local $iItem = _GUICtrlTreeView_HitTestItem($hTreeView, $iX, $iY) If $iItem <> 0 Then ShellExecute(@ProgramFilesDir & "\AutoIt3\Examples\" & _GUICtrlTreeView_GetText($hTreeView, $iItem)) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Func _ScreenToClient($hWnd, $tPOINT) Local $aRet = DllCall("user32.dll", "int", "ScreenToClient", _ "hwnd", $hTreeView, _ "ptr", DllStructGetPtr($tPOINT)) Return $aRet[0] EndFunc ;==>_ScreenToClient Link to comment Share on other sites More sharing options...
syno Posted December 28, 2008 Author Share Posted December 28, 2008 Thanks for your help... I will give that a go!!! Link to comment Share on other sites More sharing options...
syno Posted December 30, 2008 Author Share Posted December 30, 2008 Hello again My Tree View now has two branches, referencing the files on each branch to specific folders on the C: drive. I have done this by simply duplicated the lines as follows: $cTreeView_MainItem = GUICtrlCreateTreeViewItem("Files", $cTreeView) $cTreeView_MainItem2 = GUICtrlCreateTreeViewItem("Files", $cTreeView) Dim $aFiles = _FileListToArray(@ProgramFilesDir & "\AutoIt3\Examples", "*.au3", 1) Dim $aFiles2 = _FileListToArray(@ProgramFilesDir & "\AutoIt3\Examples2", "*.au3", 1) For $i = 1 To $aFiles[0] GUICtrlCreateTreeViewItem($aFiles[$i], $cTreeView_MainItem) Next For $i = 1 To $aFiles2[0] GUICtrlCreateTreeViewItem($aFiles2[$i], $cTreeView_MainItem2) Next I know there is probably a better way of doing this but this is fine for now. The first branch works and I can select the files listed. However when trying to select the files on the second branch it fails saying that 'Windows cannot find' the location back to the file as it is referencing the location for the first branch.... It looks like I need to change this line somewhere in your example: If $iItem <> 0 Then ShellExecute(@ProgramFilesDir & "\AutoIt3\Examples\" & but I am not entirly sure where to go next with this. Would it be possible to use this second branch in the same way as the first branch but reference a different set of files, lets say from another folder... Thanks Link to comment Share on other sites More sharing options...
Zedna Posted December 30, 2008 Share Posted December 30, 2008 Provide full example code and I will repair it for you. Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
syno Posted December 30, 2008 Author Share Posted December 30, 2008 (edited) expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiTreeView.au3> #include <File.au3> ; CREATE GUI $Style = BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS) $hGUI = GUICreate("Automated Test Scripts", 300,300) $cTreeView = GUICtrlCreateTreeView(10,60,280,230, $Style) $hTreeView = GUICtrlGetHandle($cTreeView) $cTreeView_MainItem = GUICtrlCreateTreeViewItem("MSDE", $cTreeView) $cTreeView_MainItem2 = GUICtrlCreateTreeViewItem("SQLExpress", $cTreeView) Dim $aFiles = _FileListToArray("C:\Documents and Settings\My Documents\Corrupted SQL\MSDE","*.sql", 1) Dim $aFiles2 = _FileListToArray("C:\Documents and Settings\My Documents\Corrupted SQL\SQLExpress","*.sql", 1) For $i = 1 To $aFiles[0] GUICtrlCreateTreeViewItem($aFiles[$i], $cTreeView_MainItem) Next For $i = 1 To $aFiles2[0] GUICtrlCreateTreeViewItem($aFiles2[$i], $cTreeView_MainItem2) Next ; LOGO / PIC GuiCtrlCreatePic("logo3.bmp",0,0,0,0) ; INSTRUCTIONS GUICtrlCreateLabel("Please Choose Script to Run Below:",70,30) GUICtrlSetColor(-1,0xFF0000); Makes instructions Red GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $tNMHDR, $hWndFrom, $iCode $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hTreeView Switch $iCode Case $NM_DBLCLK Local $tPOINT = DllStructCreate("int X;int Y") DllStructSetData($tPOINT, "X", MouseGetPos(0)) DllStructSetData($tPOINT, "Y", MouseGetPos(1)) _ScreenToClient($hTreeView, $tPOINT) Local $iX = DllStructGetData($tPOINT, "X") Local $iY = DllStructGetData($tPOINT, "Y") Local $iItem = _GUICtrlTreeView_HitTestItem($hTreeView, $iX, $iY) If $iItem <> 0 Then ShellExecute("C:\Documents and Settings\My Documents\Corrupted SQL\MSDE\" & _GUICtrlTreeView_GetText($hTreeView, $iItem)) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Func _ScreenToClient($hWnd, $tPOINT) Local $aRet = DllCall("user32.dll", "int", "ScreenToClient", _ "hwnd", $hTreeView, _ "ptr", DllStructGetPtr($tPOINT)) Return $aRet[0] EndFunc;==>_ScreenToClient Edited December 30, 2008 by syno Link to comment Share on other sites More sharing options...
Zedna Posted December 30, 2008 Share Posted December 30, 2008 (edited) expandcollapse popup#include <GuiConstantsEx.au3>#include <WindowsConstants.au3> #include <GuiTreeView.au3> #include <File.au3> ; CREATE GUI $Style = BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS) $hGUI = GUICreate("Automated Test Scripts", 300,300) $cTreeView = GUICtrlCreateTreeView(10,60,280,230, $Style) $hTreeView = GUICtrlGetHandle($cTreeView) $cTreeView_MainItem = GUICtrlCreateTreeViewItem("MSDE", $cTreeView) $cTreeView_MainItem2 = GUICtrlCreateTreeViewItem("SQLExpress", $cTreeView) Dim $aFiles = _FileListToArray("C:\Documents and Settings\My Documents\Corrupted SQL\MSDE","*.sql", 1) Dim $aFiles2 = _FileListToArray("C:\Documents and Settings\My Documents\Corrupted SQL\SQLExpress","*.sql", 1) For $i = 1 To $aFiles[0] GUICtrlCreateTreeViewItem($aFiles[$i], $cTreeView_MainItem) Next For $i = 1 To $aFiles2[0] GUICtrlCreateTreeViewItem($aFiles2[$i], $cTreeView_MainItem2) Next ; LOGO / PIC GuiCtrlCreatePic("logo3.bmp",0,0,0,0) ; INSTRUCTIONS GUICtrlCreateLabel("Please Choose Script to Run Below:",70,30) GUICtrlSetColor(-1,0xFF0000); Makes instructions Red GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $tNMHDR, $hWndFrom, $iCode $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hTreeView Switch $iCode Case $NM_DBLCLK Local $tPOINT = DllStructCreate("int X;int Y") DllStructSetData($tPOINT, "X", MouseGetPos(0)) DllStructSetData($tPOINT, "Y", MouseGetPos(1)) _ScreenToClient($hTreeView, $tPOINT) Local $iX = DllStructGetData($tPOINT, "X") Local $iY = DllStructGetData($tPOINT, "Y") Local $iItem = _GUICtrlTreeView_HitTestItem($hTreeView, $iX, $iY) If $iItem <> 0 And _GUICtrlTreeView_Level ($hTreeView, $iItem) = 1 Then $parent_id = _GUICtrlTreeView_GetParentHandle($hTreeView, $iItem) $parent_text = _GUICtrlTreeView_GetText($hTreeView, $parent_id) If $parent_text = 'MSDE' Then $dir = "C:\Documents and Settings\My Documents\Corrupted SQL\MSDE\" ElseIf $parent_text = 'SQLExpress' Then $dir = "C:\Documents and Settings\My Documents\Corrupted SQL\SQLExpress\" EndIf ShellExecute($dir & _GUICtrlTreeView_GetText($hTreeView, $iItem)) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Func _ScreenToClient($hWnd, $tPOINT) Local $aRet = DllCall("user32.dll", "int", "ScreenToClient", _ "hwnd", $hTreeView, _ "ptr", DllStructGetPtr($tPOINT)) Return $aRet[0] EndFunc;==>_ScreenToClient Edited December 30, 2008 by Zedna Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted December 30, 2008 Share Posted December 30, 2008 (edited) Here is more elegant solution using _GUICtrlTreeView_SetItemParam/_GUICtrlTreeView_GetItemParam as index to array of directories expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiTreeView.au3> #include <File.au3> ; _GUICtrlTreeView_SetItemParam will be index to this array of directories Global $dir[2] = ["C:\Documents and Settings\My Documents\Corrupted SQL\MSDE\", _ "C:\Documents and Settings\My Documents\Corrupted SQL\SQLExpress\"] ; CREATE GUI $Style = BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS) $hGUI = GUICreate("Automated Test Scripts", 300,300) $cTreeView = GUICtrlCreateTreeView(10,60,280,230, $Style) $hTreeView = GUICtrlGetHandle($cTreeView) $cTreeView_MainItem = GUICtrlCreateTreeViewItem("MSDE", $cTreeView) $cTreeView_MainItem2 = GUICtrlCreateTreeViewItem("SQLExpress", $cTreeView) Dim $aFiles = _FileListToArray($dir[0],"*.sql", 1) Dim $aFiles2 = _FileListToArray($dir[1],"*.sql", 1) For $i = 1 To $aFiles[0] $item = GUICtrlCreateTreeViewItem($aFiles[$i], $cTreeView_MainItem) $hItem = GUICtrlGetHandle($item) _GUICtrlTreeView_SetItemParam($hTreeView, $hItem, 0) ; index 0 Next For $i = 1 To $aFiles2[0] $item = GUICtrlCreateTreeViewItem($aFiles2[$i], $cTreeView_MainItem2) $hItem = GUICtrlGetHandle($item) _GUICtrlTreeView_SetItemParam($hTreeView, $hItem, 1) ; index 1 Next ; LOGO / PIC GuiCtrlCreatePic("logo3.bmp",0,0,0,0) ; INSTRUCTIONS GUICtrlCreateLabel("Please Choose Script to Run Below:",70,30) GUICtrlSetColor(-1,0xFF0000); Makes instructions Red GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $tNMHDR, $hWndFrom, $iCode $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hTreeView Switch $iCode Case $NM_DBLCLK Local $tPOINT = DllStructCreate("int X;int Y") DllStructSetData($tPOINT, "X", MouseGetPos(0)) DllStructSetData($tPOINT, "Y", MouseGetPos(1)) _ScreenToClient($hTreeView, $tPOINT) Local $iX = DllStructGetData($tPOINT, "X") Local $iY = DllStructGetData($tPOINT, "Y") Local $iItem = _GUICtrlTreeView_HitTestItem($hTreeView, $iX, $iY) If $iItem <> 0 And _GUICtrlTreeView_Level ($hTreeView, $iItem) = 1 Then $index = _GUICtrlTreeView_GetItemParam($hTreeView, $iItem) ShellExecute($dir[$index] & _GUICtrlTreeView_GetText($hTreeView, $iItem)) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Func _ScreenToClient($hWnd, $tPOINT) Local $aRet = DllCall("user32.dll", "int", "ScreenToClient", _ "hwnd", $hTreeView, _ "ptr", DllStructGetPtr($tPOINT)) Return $aRet[0] EndFunc;==>_ScreenToClient Edited December 30, 2008 by Zedna Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
ProgAndy Posted December 30, 2008 Share Posted December 30, 2008 (edited) I think, if you use the built-in functions to create the items, the CTRLID is saved as itemparam. So, if you change it, the GUICTRL functions won't work anymore.Edit: no, works. with hanged param, too. Edited December 30, 2008 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Zedna Posted December 30, 2008 Share Posted December 30, 2008 (edited) I think, if you use the built-in functions to create the items, the CTRLID is saved as itemparam.I didn't know about that.So, if you change it, the GUICTRL functions won't work anymore. Right?So if CTRLID is really saved in itemparam then of course you are right.In this example CTRLID for treeview items are not used so it will be OK even if it's destroyed but generally it may be problem.Correct solution would be to use of i_GUICtrlTreeView_Add ()/_GUICtrlTreeView_AddChild() nstead of GUICtrlCreateTreeViewItem()EDIT: My examples works OK I tested them successfully Edited December 30, 2008 by Zedna Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
syno Posted December 31, 2008 Author Share Posted December 31, 2008 Thats great Thank you very much for all your help...... 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