MariusN Posted January 4, 2010 Posted January 4, 2010 (edited) Below is a small script. what it does is you can drag and drop files in the "GUICtrlCreateInput" and once the "OK" button is clicked, everything will be listed in a "GUICtrlCreateTreeView". How can i adjust the code so it will execute the file in the "GUICtrlCreateTreeView"-area (ie $item[0]) when clicked on? I did try the search in the forums before on this, but is still a little confused using the "on click" item... This will help me a lot...thank you guys expandcollapse popupFunc Example() Local $btn, $msg, $file[10], $hListView1, $hListView2,$1, $2, $3, $4, $5, $6, $hListItem, $hListItem2,$item[20] Local $treeview, $read[20] GUICreate(" My GUI input acceptfile", 450, 450, -1, -1, -1, $WS_EX_ACCEPTFILES); WS_EX_ACCEPTFILES $file[0] = GUICtrlCreateInput("", 50, 40, 350, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $file[1] = GUICtrlCreateInput("", 50, 70, 350, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $file[2] = GUICtrlCreateInput("", 50, 100, 350, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $file[3] = GUICtrlCreateInput("", 50, 130, 350, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $file[4] = GUICtrlCreateInput("", 50, 160, 350, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $file[5] = GUICtrlCreateInput("", 50, 190, 350, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $btn = GUICtrlCreateButton("Ok", 40, 420, 60, 20) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn $read[0] = GUICtrlRead($file[0]) $read[1] = GUICtrlRead($file[1]) $read[2] = GUICtrlRead($file[2]) $read[3] = GUICtrlRead($file[3]) $read[4] = GUICtrlRead($file[4]) $read[5] = GUICtrlRead($file[5]) $treeview = GUICtrlCreateTreeView(10, 250, 390, 150, BitOR($TVS_LINESATROOT, $TVS_FULLROWSELECT, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $item[0] = GUICtrlCreateTreeViewItem($read[0], $treeview) $item[1] = GUICtrlCreateTreeViewItem($read[1], $treeview) $item[2] = GUICtrlCreateTreeViewItem($read[2], $treeview) $item[3] = GUICtrlCreateTreeViewItem($read[3], $treeview) EndSelect WEnd Edited January 4, 2010 by MariusN
botanic Posted January 4, 2010 Posted January 4, 2010 Select Case $msg = $btn $read[0] = GUICtrlRead($file[0]) $read[1] = GUICtrlRead($file[1]) $read[2] = GUICtrlRead($file[2]) $read[3] = GUICtrlRead($file[3]) $read[4] = GUICtrlRead($file[4]) $read[5] = GUICtrlRead($file[5]) $treeview = GUICtrlCreateTreeView(10, 250, 390, 150, BitOR($TVS_LINESATROOT, $TVS_FULLROWSELECT, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $item[0] = GUICtrlCreateTreeViewItem($read[0], $treeview) $item[1] = GUICtrlCreateTreeViewItem($read[1], $treeview) $item[2] = GUICtrlCreateTreeViewItem($read[2], $treeview) $item[3] = GUICtrlCreateTreeViewItem($read[3], $treeview) EndSelect everything after Case $msg = $btn will happen when the button is clicked.
MariusN Posted January 4, 2010 Author Posted January 4, 2010 Select Case $msg = $btn $read[0] = GUICtrlRead($file[0]) $read[1] = GUICtrlRead($file[1]) $read[2] = GUICtrlRead($file[2]) $read[3] = GUICtrlRead($file[3]) $read[4] = GUICtrlRead($file[4]) $read[5] = GUICtrlRead($file[5]) $treeview = GUICtrlCreateTreeView(10, 250, 390, 150, BitOR($TVS_LINESATROOT, $TVS_FULLROWSELECT, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $item[0] = GUICtrlCreateTreeViewItem($read[0], $treeview) $item[1] = GUICtrlCreateTreeViewItem($read[1], $treeview) $item[2] = GUICtrlCreateTreeViewItem($read[2], $treeview) $item[3] = GUICtrlCreateTreeViewItem($read[3], $treeview) EndSelect everything after Case $msg = $btn will happen when the button is clicked. Yes i know, but what i want to do is AFTER the above function has completed, and the info is put in the GUICtrlCreateTreeView"-area, i want to be able to click on, let's say the second line ( of the data already in the GUICtrlCreateTreeView"-area, or in ther words, the "GUICtrlCreateTreeViewItem no2" entry, and it must execute... I'm basicly looking for a double-click function
MariusN Posted January 4, 2010 Author Posted January 4, 2010 (edited) expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GuiTreeView.au3> #include <Array.au3> ;Opt("MustDeclareVars", 1) ;Global $treeview[20] = [1, 19, 1] ;Global $aItem_Handles[UBound($treeview)] Local $button, $msg, $file[10], $hListView1, $hListView2, $1, $2, $3, $4, $5, $6, $hListItem, $hListItem2 Local $treeview, $read[20], $fDblClk, $sText,$item[10] GUICreate(" My GUI input acceptfile", 450, 450, -1, -1, -1, $WS_EX_ACCEPTFILES); WS_EX_ACCEPTFILES $file[0] = GUICtrlCreateInput("", 50, 40, 350, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $file[1] = GUICtrlCreateInput("", 50, 70, 350, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $file[2] = GUICtrlCreateInput("", 50, 100, 350, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $file[3] = GUICtrlCreateInput("", 50, 130, 350, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $file[4] = GUICtrlCreateInput("", 50, 160, 350, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $file[5] = GUICtrlCreateInput("", 50, 190, 350, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $button = GUICtrlCreateButton("Ok", 40, 420, 60, 20) GUISetState() GUIRegisterMsg($WM_NOTIFY, "MY_WM_NOTIFY") Global $fDblClk = False While 1 $MSG = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button $read[0] = GUICtrlRead($file[0]) $read[1] = GUICtrlRead($file[1]) $read[2] = GUICtrlRead($file[2]) $read[3] = GUICtrlRead($file[3]) $read[4] = GUICtrlRead($file[4]) $read[5] = GUICtrlRead($file[5]) $treeview = GUICtrlCreateTreeView(10, 250, 390, 150, BitOR($TVS_LINESATROOT, $TVS_FULLROWSELECT, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $item[0] = GUICtrlCreateTreeViewItem($read[0], $treeview) $item[1] = GUICtrlCreateTreeViewItem($read[1], $treeview) $item[2] = GUICtrlCreateTreeViewItem($read[2], $treeview) $item[3] = GUICtrlCreateTreeViewItem($read[3], $treeview) EndSelect If $fDblClk = True Then $sText = _GUICtrlTreeView_GetText($treeview, _GUICtrlTreeView_GetSelection($treeview)) MsgBox(0, "Hit", "You double clicked on " & $sText) $fDblClk = False EndIf WEnd Func MY_WM_NOTIFY($hWnd, $msg, $wParam, $lParam) Switch $wParam Case $treeview Local $tagNMHDR = DllStructCreate("int;int;int", $lParam) If @error Then Return If DllStructGetData($tagNMHDR, 3) = $NM_DBLCLK Then $fDblClk = True EndSwitch ;$tagNMHDR = 0 EndFunc ;==>MY_WM_NOTIFY I got so far, but get an error on $tagNMHDR = 0 "Cannot assign values to constants.:" If i disable $tagNMHDR = 0, it works, but only so-so the problem lies if i move the mouse over the "ok" button... Edited January 4, 2010 by MariusN
MariusN Posted January 4, 2010 Author Posted January 4, 2010 (edited) Problem SOLVED!!!....Yeee HAA!!! i had very sh!tty coding Edited January 4, 2010 by MariusN
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