ShawnW Posted October 27, 2010 Share Posted October 27, 2010 (edited) Here is my list view declaration. $ConList = GUICtrlCreateListView("Conditions", 30, 90, 285, 119, BitOR($WS_VSCROLL,$WS_BORDER,$LVS_SHOWSELALWAYS), 0) Here is how I add items to the list. When the proper button is pressed this code runs. AddCondition() just creates a 2nd form dialog box to gather info and returns a string. This part works in adding items to the list. $ListItem = AddCondition() If $ListItem <> "" Then _ArrayAdd($ConListItems,_GUICtrlListView_AddItem($ConList,$ListItem)) _GUICtrlListView_SetColumnWidth($ConList,0,$LVSCW_AUTOSIZE) $ConListItems[0] += 1 EndIf And here is how I am trying to delete item(s) selected when another button is pressed, but nothing seems to happen other than the item actually gets deselected. _GUICtrlListView_DeleteItemsSelected($ConList) Could use some suggestions on how to get this to work. Thanks, Shawn Edited October 27, 2010 by ShawnW Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 27, 2010 Moderators Share Posted October 27, 2010 ShawnW,You have been here long enough to know that you need to provide some working code if you want help on a problem like this. No-one is going to code a whole GUI to fit around your snippets - which are probably not the cause anyway. So go and write a nice short reproducer script that we can run and debug and then you might stand a chance of someone helping. 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...
ShawnW Posted October 27, 2010 Author Share Posted October 27, 2010 (edited) ShawnW, You have been here long enough to know that you need to provide some working code if you want help on a problem like this. No-one is going to code a whole GUI to fit around your snippets - which are probably not the cause anyway. So go and write a nice short reproducer script that we can run and debug and then you might stand a chance of someone helping. M23 Your right I should know, here ya go. #include <Array.au3> #include <GUIConstantsEx.au3> #include <GUIListView.au3> #include <WindowsConstants.au3> $InstallBuilder = GUICreate("Install Builder", 345, 240) ; Create Run Conditions group Local $ConListItems[1] = [0] $RunConditions = GUICtrlCreateGroup(" Run Conditions ", 15, 15, 315, 210) $RCAdd = GUICtrlCreateButton("Add Condition", 30, 60, 85, 25, $WS_GROUP) $RCRemove = GUICtrlCreateButton("Remove Condition", 210, 60, 105, 25, $WS_GROUP) $ConList = GUICtrlCreateListView("Conditions", 30, 90, 285, 119, BitOR($WS_VSCROLL,$WS_BORDER,$LVS_SHOWSELALWAYS), 0) GUICtrlSetFont($RunConditions, 10, 800) GUICtrlCreateGroup("", -99, -99, 1, 1) ; Close Run Conditions group GUISetState(@SW_SHOW, $InstallBuilder) ; Show GUI While True $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $RCAdd _ArrayAdd($ConListItems,_GUICtrlListView_AddItem($ConList,"Hello " & $ConListItems[0])) _GUICtrlListView_SetColumnWidth($ConList,0,$LVSCW_AUTOSIZE) $ConListItems[0] += 1 Case $RCRemove _GUICtrlListView_DeleteItemsSelected($ConList) EndSwitch WEnd Edit: Took a couple unnecessary lines out of my example. Edited October 27, 2010 by ShawnW Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 27, 2010 Share Posted October 27, 2010 Might be another case of mixing UDF functions with native controls. This works: #include <Array.au3> #include <GUIConstantsEx.au3> #include <GUIListView.au3> #include <WindowsConstants.au3> $InstallBuilder = GUICreate("Install Builder", 345, 240) ; Create Run Conditions group Local $aConListItems[1] = [0] $RunConditions = GUICtrlCreateGroup(" Run Conditions ", 15, 15, 315, 210) $RCAdd = GUICtrlCreateButton("Add Condition", 30, 60, 85, 25, $WS_GROUP) $RCRemove = GUICtrlCreateButton("Remove Condition", 210, 60, 105, 25, $WS_GROUP) $hConList = _GUICtrlListView_Create($InstallBuilder, "Conditions", 30, 90, 285, 119) GUICtrlSetFont($RunConditions, 10, 800) GUICtrlCreateGroup("", -99, -99, 1, 1) ; Close Run Conditions group GUISetState(@SW_SHOW, $InstallBuilder) ; Show GUI While True $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $RCAdd $ListItem = "Hello " & $aConListItems[0] _ArrayAdd($aConListItems, _GUICtrlListView_AddItem($hConList, $ListItem)) _GUICtrlListView_SetColumnWidth($hConList, 0, $LVSCW_AUTOSIZE) $aConListItems[0] += 1 Case $RCRemove _GUICtrlListView_DeleteItemsSelected($hConList) EndSwitch WEnd Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ShawnW Posted October 27, 2010 Author Share Posted October 27, 2010 That seems to be the problem, thanks PsaltyDS. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 27, 2010 Moderators Share Posted October 27, 2010 PsaltyDS,another case of mixing UDF functions with native controlsBecoming your speciality lately! ShawnW,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