misterDee Posted November 12, 2009 Share Posted November 12, 2009 Hi there, I have a problem mayb you can help me.. In my GUI i have a _GUICtrlListView_ with groups and items.. is it possible when i clicked on a item in a group that will result in a inputbox (GUICtrlCreateInput)? thanks!! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 12, 2009 Moderators Share Posted November 12, 2009 misterDee, Welcome to the AutoIt forums. Would this be close to what you are looking for? Without more details it is hard to tell. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Opt('MustDeclareVars', 1) Global $fClick = False, $hLV_Handle GUIRegisterMsg($WM_NOTIFY, "MY_WM_NOTIFY") Example() Func Example() Local $listview, $msg, $aitem[3], $iIndex, $sNew_Data GUICreate("listview items", 220, 250, 100, 200) $listview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 150) $hLV_Handle = GUICtrlGetHandle($listview) $aitem[0] = GUICtrlCreateListViewItem("item1|col12|col13", $listview) $aitem[1] = GUICtrlCreateListViewItem("item2|col22|col23", $listview) $aitem[2] = GUICtrlCreateListViewItem("item3|col32|col33", $listview) GUISetState() Do If $fClick = True Then $fClick = False $iIndex = _GUICtrlListView_GetSelectedIndices($hLV_Handle) $sNew_Data = InputBox("New Data", "Please input new data") GUICtrlSetData($aitem[$iIndex], $sNew_Data) EndIf Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>Example Func MY_WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $tNMHDR = DllStructCreate("int;int;int", $lParam) If @error Then Return If DllStructGetData($tNMHDR, 1) = $hLV_Handle Then If DllStructGetData($tNMHDR, 3) = $NM_CLICK Then $fClick = True EndIf $tNMHDR = 0 Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_NOTIFY M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
misterDee Posted November 12, 2009 Author Share Posted November 12, 2009 (edited) Hi there, I have a problem mayb you can help me.. In my GUI i have a _GUICtrlListView_ with groups and items.. is it possible when i clicked on a item in a group that will result in a inputbox (GUICtrlCreateInput)? thanks!! Hi Melba, Thanks for replay and posting a script.. its not exactly what i mean.. sorry for the less information i will drop my script so u can see it by your self.. #include <GUIConstants.au3> #include <Date.au3> #include <String.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #Include <WindowsConstants.au3> #include <TreeViewConstants.au3> #include <StaticConstants.au3> #include <GuiTreeView.au3> $gui=GUICreate("TEST TEST TEST ", 790, 700, 134, 81, -1, BitOR($WS_EX_ACCEPTFILES,$WS_EX_APPWINDOW,$WS_MINIMIZEBOX,$WS_EX_RIGHT,$WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE)) GUISetBkColor(0xFFFFFF) GUICtrlCreatePic(@ScriptDir&"\img\main_bg_top.jpg", 0, 0, 790, 78) ;GUICtrlCreatePic(@ScriptDir&"\img\main_bg_left.jpg", 0, 78, 245, 443) GUICtrlCreatePic(@ScriptDir&"\img\main_bg_bottom.jpg", 0, 666, 790, 35) $iniread=IniRead(@scriptdir&"\config.ini", "General", "Schoolnaam", "Niet gedefineerd") GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlCreateLabel($iniread, 440, 27, 500, 500) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, 13, "", 2) GUICtrlCreateInput("", 180, 103, 120, 20) GUICtrlCreateInput("", 180, 133, 120, 20, 0x0020) GUICtrlCreateButton("Inloggen!", 230, 163, 69, 21) Local $GUI, $hImage, $hListView, $aImage Local $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER) ;========================================================================================================= $hListView = _GUICtrlListView_Create($GUI, "", 0, 79, 170, 580, -1, -1, True) ;========================================================================================================= _GUICtrlListView_SetExtendedListViewStyle($hListView, $exStyles) _GUICtrlListView_SetImageList($hListView, $hImage, 1) _GUICtrlListView_EnableGroupView($hListView) _GUICtrlListView_InsertGroup($hListView, -1, 1, "Groep 1") _GUICtrlListView_InsertGroup($hListView, -1, 2, "Groep 2") _GUICtrlListView_InsertGroup($hListView, -1, 3, "Groep 3") _GUICtrlListView_InsertGroup($hListView, -1, 4, "Groep 4") _GUICtrlListView_InsertGroup($hListView, -1, 5, "Groep 5") _GUICtrlListView_InsertGroup($hListView, -1, 6, "Groep 6") _GUICtrlListView_InsertGroup($hListView, -1, 7, "Groep 7") _GUICtrlListView_InsertGroup($hListView, -1, 8, "Groep 8") _GUICtrlListView_InsertGroup($hListView, -1, 10, "ICT Coordinator") _GUICtrlListView_InsertColumn($hListView, 0, "Hoofdmenu", 170) $user1=iniread(@scriptdir&"\users\users.ini", "users", 1, "") $user2=iniread(@scriptdir&"\users\users.ini", "users", 2, "") $user3=iniread(@scriptdir&"\users\users.ini", "users", 3, "") $user4=iniread(@scriptdir&"\users\users.ini", "users", 4, "") $user5=iniread(@scriptdir&"\users\users.ini", "users", 5, "") $user6=iniread(@scriptdir&"\users\users.ini", "users", 6, "") $user7=iniread(@scriptdir&"\users\users.ini", "users", 7, "") $user8=iniread(@scriptdir&"\users\users.ini", "users", 8, "") $user9=iniread(@scriptdir&"\users\users.ini", "users", 9, "") _GUICtrlListView_AddItem($hListView, "", 0) _GUICtrlListView_AddItem($hListView, $user1, 1) _GUICtrlListView_AddItem($hListView, $user2, 2) _GUICtrlListView_AddItem($hListView, $user3, 3) _GUICtrlListView_AddItem($hListView, $user4, 4) _GUICtrlListView_AddItem($hListView, $user5, 5) _GUICtrlListView_AddItem($hListView, $user6, 6) _GUICtrlListView_AddItem($hListView, $user7, 7) _GUICtrlListView_AddItem($hListView, $user8, 8) _GUICtrlListView_AddItem($hListView, $user9, 10) _GUICtrlListView_SetItemGroupID($hListView, 1, 1) _GUICtrlListView_SetItemGroupID($hListView, 2, 2) _GUICtrlListView_SetItemGroupID($hListView, 3, 3) _GUICtrlListView_SetItemGroupID($hListView, 4, 4) _GUICtrlListView_SetItemGroupID($hListView, 5, 5) _GUICtrlListView_SetItemGroupID($hListView, 6, 6) _GUICtrlListView_SetItemGroupID($hListView, 7, 7) _GUICtrlListView_SetItemGroupID($hListView, 8, 8) _GUICtrlListView_SetItemGroupID($hListView, 9, 10) GUISetState() While 1 $nMsg=GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd i want, if i click on a item in a group that the item will show in the first inputbox on the right.. if its possible it must be disable.. so no edit only read.. everytime you click on a item the name must change in the first inputbox. info inifile: [users] 1=Leraar Groep 1 2=Leraar Groep 2 3=Leraar Groep 3 4=Leraar Groep 4 5=Leraar Groep 5 6=Leraar Groep 6 7=Leraar Groep 7 8=Leraar Groep 8 9=ICT Coordinator Thanks again for replay, sorry for my bad english and the messy script MisterDee Edited November 12, 2009 by misterDee Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 12, 2009 Moderators Share Posted November 12, 2009 (edited) misterDee,That is a bit clearer. If you want a read-only control, I suggest an Edit with the $ES_READONLY style. Then you need a slightly modified function to be registered for a single click on the ListView. And you get this:expandcollapse popup#include <GUIConstants.au3> #include <Date.au3> #include <String.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <TreeViewConstants.au3> #include <StaticConstants.au3> #include <GuiTreeView.au3> Global $fClick = False $GUI = GUICreate("TEST TEST TEST ", 790, 700, 134, 81, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_APPWINDOW, $WS_MINIMIZEBOX, $WS_EX_RIGHT, $WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE)) GUISetBkColor(0xFFFFFF) GUICtrlCreatePic(@ScriptDir & "\img\main_bg_top.jpg", 0, 0, 790, 78) ;GUICtrlCreatePic(@ScriptDir&"\img\main_bg_left.jpg", 0, 78, 245, 443) GUICtrlCreatePic(@ScriptDir & "\img\main_bg_bottom.jpg", 0, 666, 790, 35) $iniread = IniRead(@ScriptDir & "\config.ini", "General", "Schoolnaam", "Niet gedefineerd") GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlCreateLabel($iniread, 440, 27, 500, 500) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, 13, "", 2) $hEdit = GUICtrlCreateEdit("", 180, 103, 120, 20, $ES_READONLY) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlCreateInput("", 180, 133, 120, 20, 0x0020) GUICtrlCreateButton("Inloggen!", 230, 163, 69, 21) Local $GUI, $hImage, $hListView, $aImage Local $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER) ;========================================================================================================= $hListView = _GUICtrlListView_Create($GUI, "", 0, 79, 170, 580, -1, -1 , True) ;========================================================================================================= _GUICtrlListView_SetExtendedListViewStyle($hListView, $exStyles) _GUICtrlListView_SetImageList($hListView, $hImage, 1) _GUICtrlListView_EnableGroupView($hListView) _GUICtrlListView_InsertGroup($hListView, -1, 1, "Groep 1") _GUICtrlListView_InsertGroup($hListView, -1, 2, "Groep 2") _GUICtrlListView_InsertGroup($hListView, -1, 3, "Groep 3") _GUICtrlListView_InsertGroup($hListView, -1, 4, "Groep 4") _GUICtrlListView_InsertGroup($hListView, -1, 5, "Groep 5") _GUICtrlListView_InsertGroup($hListView, -1, 6, "Groep 6") _GUICtrlListView_InsertGroup($hListView, -1, 7, "Groep 7") _GUICtrlListView_InsertGroup($hListView, -1, 8, "Groep 8") _GUICtrlListView_InsertGroup($hListView, -1, 10, "ICT Coordinator") _GUICtrlListView_InsertColumn($hListView, 0, "Hoofdmenu", 170) $user1 = IniRead(@ScriptDir & "\users\users.ini", "users", 1, "user1") $user2 = IniRead(@ScriptDir & "\users\users.ini", "users", 2, "user2") $user3 = IniRead(@ScriptDir & "\users\users.ini", "users", 3, "user3") $user4 = IniRead(@ScriptDir & "\users\users.ini", "users", 4, "user4") $user5 = IniRead(@ScriptDir & "\users\users.ini", "users", 5, "user5") $user6 = IniRead(@ScriptDir & "\users\users.ini", "users", 6, "user6") $user7 = IniRead(@ScriptDir & "\users\users.ini", "users", 7, "user7") $user8 = IniRead(@ScriptDir & "\users\users.ini", "users", 8, "user8") $user9 = IniRead(@ScriptDir & "\users\users.ini", "users", 9, "user9") _GUICtrlListView_AddItem($hListView, "", 0) _GUICtrlListView_AddItem($hListView, $user1, 1) _GUICtrlListView_AddItem($hListView, $user2, 2) _GUICtrlListView_AddItem($hListView, $user3, 3) _GUICtrlListView_AddItem($hListView, $user4, 4) _GUICtrlListView_AddItem($hListView, $user5, 5) _GUICtrlListView_AddItem($hListView, $user6, 6) _GUICtrlListView_AddItem($hListView, $user7, 7) _GUICtrlListView_AddItem($hListView, $user8, 8) _GUICtrlListView_AddItem($hListView, $user9, 10) _GUICtrlListView_SetItemGroupID($hListView, 1, 1) _GUICtrlListView_SetItemGroupID($hListView, 2, 2) _GUICtrlListView_SetItemGroupID($hListView, 3, 3) _GUICtrlListView_SetItemGroupID($hListView, 4, 4) _GUICtrlListView_SetItemGroupID($hListView, 5, 5) _GUICtrlListView_SetItemGroupID($hListView, 6, 6) _GUICtrlListView_SetItemGroupID($hListView, 7, 7) _GUICtrlListView_SetItemGroupID($hListView, 8, 8) _GUICtrlListView_SetItemGroupID($hListView, 9, 10) GUIRegisterMsg($WM_NOTIFY, "MY_WM_NOTIFY") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If $fClick = True Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< All this section ConsoleWrite("Here" & @CRLF) $fClick = False $iIndex = _GUICtrlListView_GetSelectedIndices($hListView) ConsoleWrite($iIndex & @CRLF) $sText = _GUICtrlListView_GetItemText($hListView, $iIndex) GUICtrlSetData($hEdit, $sText) EndIf WEnd Func MY_WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) ; <<<<<<<<<<<<<<<< All this function #forceref $hWnd, $iMsg, $iwParam Local $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) If HWnd(DllStructGetData($tNMHDR, "hWndFrom")) = $hListView Then If DllStructGetData($tNMHDR, "Code") = $NM_CLICK Then $fClick = True EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFYLook for the <<<<<<<<<<<<<<<<<< lines. Are we getting close now?M23P.S. When you post code, it helps if you use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here). Edit: Minor code change - removing debug lines Edited November 12, 2009 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
misterDee Posted November 13, 2009 Author Share Posted November 13, 2009 Hi Melba, Thanks for replay and posting a script.. its not exactly what i mean.. sorry for the less information i will drop my script so u can see it by your self.. i want, if i click on a item in a group that the item will show in the first inputbox on the right.. if its possible it must be disable.. so no edit only read.. everytime you click on a item the name must change in the first inputbox. info inifile: [users] 1=Leraar Groep 1 2=Leraar Groep 2 3=Leraar Groep 3 4=Leraar Groep 4 5=Leraar Groep 5 6=Leraar Groep 6 7=Leraar Groep 7 8=Leraar Groep 8 9=ICT Coordinator Thanks again for replay, sorry for my bad english and the messy script MisterDee Melba, Wauw.. thats exactly what im lookin' for, thanks a lot!!!! thanks for the tips, your the best! 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