nullschritt Posted January 31, 2014 Share Posted January 31, 2014 Hello all, I was wondering if there was a way to put drop down lists in a list view? So that say for example, I have a listview of users, and want a drop down in the same row as each user, to select a custom key to be assigned to that user? like so(this image is photoshopped): Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 31, 2014 Moderators Share Posted January 31, 2014 nullschritt,My GUIListViewEx offers that exact functionality - the link is in my sig and you need to look at Example 2. 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...
nullschritt Posted January 31, 2014 Author Share Posted January 31, 2014 nullschritt, My GUIListViewEx offers that exact functionality - the link is in my sig and you need to look at Example 2. M23 Sorry, but, I don't see anything in example 2 that adds a drop down to a listview? Or is there a specific function in the code that could be used to add a listview that I've missed? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 31, 2014 Moderators Share Posted January 31, 2014 nullschritt,Run "GLVEx_Example_2.au3", click through the 2 dialogs and double-click on an item in the left-hand ListView - a combo will appear and selecting from it will replace the ListView item with the chosen value. 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...
nullschritt Posted January 31, 2014 Author Share Posted January 31, 2014 (edited) nullschritt,Run "GLVEx_Example_2.au3", click through the 2 dialogs and double-click on an item in the left-hand ListView - a combo will appear and selecting from it will replace the ListView item with the chosen value. M23Okay, I see it now. However I'm having a small problem. I need to have two columns in the list view, with only the second editable. I've extracted the code needed to modify the values, and modified it some, but it's only showing a single column in the listview, even though I've told it to make two. Can you tell me what I'm doing wrong?expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" #include <Array.au3> ; Just for display in example Global $iCount_Left = 20, $iCount_Right = 20, $vData, $aRet, $iEditMode = 0 ; Create GUI $hGUI = GUICreate("LVEx Example 2", 290, 410) ; Create Left ListView GUICtrlCreateLabel("Native ListView" & @CRLF & "Single selection - count element - editable", 10, 5, 300, 35) $cListView_Left = GUICtrlCreateListView("User|Encryption Key", 10, 40, 250, 300) _GUICtrlListView_SetExtendedListViewStyle($cListView_Left, $LVS_EX_FULLROWSELECT) _GUICtrlListView_SetColumnWidth($cListView_Left, 0, 229) ; Create array and fill Left listview Global $aLV_List_Left[$iCount_Left + 1] = [$iCount_Left] For $i = 1 To UBound($aLV_List_Left) - 1 $aLV_List_Left[$i] = "Tom "& $i - 1& "|Key1" GUICtrlCreateListViewItem($aLV_List_Left[$i], $cListView_Left) Next ; Initiate LVEx - count parameter set - blue insert mark- no drag image - editable - all columns editable by default $iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, $aLV_List_Left, 1, 0x0000FF, False, 2 + 16 + 32) _GUIListViewEx_ComboData($iLV_Left_Index, 0, "Key1|Key2|Key3") _GUIListViewEx_MsgRegister() GUISetState(@SW_SHOW) while 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch $aRet = _GUIListViewEx_EditOnClick($iEditMode) sleep(10) WEnd Edited January 31, 2014 by nullschritt Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 31, 2014 Moderators Share Posted January 31, 2014 nullschritt,You still had the first column width set to wider than the ListView - so hardly surprising that you did not see the second column. And to make only the second column editable, set the column in both _GUIListViewEx_Init & _GUIListViewEx_ComboData - like this:expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" Global $iCount = 20, $iCount_Right = 20, $iEditMode = 0 ; Create GUI $hGUI = GUICreate("Combo Example", 290, 410) ; Create ListView $cListView = GUICtrlCreateListView("User|Encryption Key", 10, 40, 250, 300) _GUICtrlListView_SetExtendedListViewStyle($cListView, $LVS_EX_FULLROWSELECT) _GUICtrlListView_SetColumnWidth($cListView, 0, 100) ; Reduce col width <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; Create array and fill listview Global $aLV_List[$iCount + 1] = [$iCount] For $i = 1 To UBound($aLV_List) - 1 $aLV_List[$i] = "Tom " & $i - 1 & "|Key1" GUICtrlCreateListViewItem($aLV_List[$i], $cListView) Next ; Initiate LVEx - count parameter set - blue insert mark- no drag image - editable - all columns editable by default $iLV_Index = _GUIListViewEx_Init($cListView, $aLV_List, 1, 0x0000FF, False, 2 + 32, "1") ; Set column 1 to be editable <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< _GUIListViewEx_ComboData($iLV_Index, 1, "Key1|Key2|Key3") ; Set the values for the combo in column 1 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< _GUIListViewEx_MsgRegister() GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch _GUIListViewEx_EditOnClick($iEditMode) WEndAll clear now? 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...
nullschritt Posted January 31, 2014 Author Share Posted January 31, 2014 nullschritt, You still had the first column width set to wider than the ListView - so hardly surprising that you did not see the second column. And to make only the second column editable, set the column in both _GUIListViewEx_Init & _GUIListViewEx_ComboData - like this: expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" Global $iCount = 20, $iCount_Right = 20, $iEditMode = 0 ; Create GUI $hGUI = GUICreate("Combo Example", 290, 410) ; Create ListView $cListView = GUICtrlCreateListView("User|Encryption Key", 10, 40, 250, 300) _GUICtrlListView_SetExtendedListViewStyle($cListView, $LVS_EX_FULLROWSELECT) _GUICtrlListView_SetColumnWidth($cListView, 0, 100) ; Reduce col width <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; Create array and fill listview Global $aLV_List[$iCount + 1] = [$iCount] For $i = 1 To UBound($aLV_List) - 1 $aLV_List[$i] = "Tom " & $i - 1 & "|Key1" GUICtrlCreateListViewItem($aLV_List[$i], $cListView) Next ; Initiate LVEx - count parameter set - blue insert mark- no drag image - editable - all columns editable by default $iLV_Index = _GUIListViewEx_Init($cListView, $aLV_List, 1, 0x0000FF, False, 2 + 32, "1") ; Set column 1 to be editable <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< _GUIListViewEx_ComboData($iLV_Index, 1, "Key1|Key2|Key3") ; Set the values for the combo in column 1 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< _GUIListViewEx_MsgRegister() GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch _GUIListViewEx_EditOnClick($iEditMode) WEnd All clear now? M23 Sure is! I feel dumb now Sorry, I'm pretty tired! Link to comment Share on other sites More sharing options...
nullschritt Posted January 31, 2014 Author Share Posted January 31, 2014 (edited) Having another problem now.... Whenever I call _GUIListViewEx_MsgRegister() It unsets my previous call to GUIRegisterMsg() Edit: I've tried simply copying and pasting the code from your function into my wm_notify command, but when I compile and run it gives me an error about a variable not being declared.... even though when I run without compiling I get no such error.... very frustrating. EditEdit: Nevermind, I found the problem. thanks for the great UDF! Edited January 31, 2014 by nullschritt Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 31, 2014 Moderators Share Posted January 31, 2014 nullschritt,Glad you got it sorted. 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...
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