Champak Posted February 27, 2009 Share Posted February 27, 2009 (edited) I'm trying to use _GUICtrlListView_Create and _GUICtrlListView_GetSelectedIndices but that doesn't work. I have to use _GUICtrlListView_Create instead of GUICtrlCreateListView because I want to be able to edit the elements in place with other functions. Is there a way to delete multiple rows with with _GUICtrlListView_Create? Edited February 27, 2009 by Champak Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 27, 2009 Moderators Share Posted February 27, 2009 Champak,From the page in very useful Help file for _GUICtrlListView_Create: "Default Style: $LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS". So you need to use BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS) as the style when you create the ListView, if you wish to make multiple selections.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...
DaRam Posted February 27, 2009 Share Posted February 27, 2009 _GUICtrlListView_SetItemSelected and ensure $LVS_SINGLESEL is not in the extended style of _GUICtrlListView_CreateI'm trying to use _GUICtrlListView_Create and _GUICtrlListView_GetSelectedIndices but that doesn't work. I have to use _GUICtrlListView_Create instead of GUICtrlCreateListView because I want to be able to edit the elements in place with other functions. Is there a way to select multiple rows with with _GUICtrlListView_Create? Link to comment Share on other sites More sharing options...
Champak Posted February 27, 2009 Author Share Posted February 27, 2009 (edited) To both of you, that's how I have it alreay: $LISTVIEW = _GUICtrlListView_Create($GUI_LIST, "COL1|COL2", 5, 5, 590, 300, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($LISTVIEW, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_TRACKSELECT)) Thanks. Edited February 27, 2009 by Champak Link to comment Share on other sites More sharing options...
DaRam Posted February 27, 2009 Share Posted February 27, 2009 Could you post more relevant code on how you are selecting and where your multi select fails? To both of you, that's how I have it alreay: $LISTVIEW = _GUICtrlListView_Create($GUI_LIST, "COL1|COL2", 5, 5, 590, 300, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($LISTVIEW, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_TRACKSELECT)) Thanks. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 27, 2009 Moderators Share Posted February 27, 2009 Champak,If I put your creation code as posted in the example from the Help file (OK, I have to change the handles, but nothing else), I can get multiple selections without any problems.You must be doing something elsewhere in your script. You are keeping the Ctrl key pressed, I suppose?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...
Champak Posted February 27, 2009 Author Share Posted February 27, 2009 (edited) I'm sorry, it was last night I saw my problem and decided to post this morning and forgot exactly what it was. The actual problem is I can't use _GUICtrlListView_GetSelectedIndices() to delete the rows. Here is my script deleting the list and array elements. But it doesn't work unless I use the other listviewcreate. $H_LISTVIEW = GUICtrlGetHandle($LISTVIEW);this is global Func Click_33();Remove $UNIVERSALVAR1 = _GUICtrlListView_GetSelectedIndices($H_LISTVIEW , True) ;_ArrayDisplay($UNIVERSALVAR1) For $I = UBound($UNIVERSALVAR1) - 1 To 1 Step -1 ;For $i = 2 To UBound($UNIVERSALVAR1) - 1 ;_CONSOLEWRITE($UNIVERSALVAR1[$i]) _ArrayDelete($POIARRAY, $UNIVERSALVAR1[$i]+2) Next _GUICtrlListView_DeleteItemsSelected($H_LISTVIEW) EndFunc Edited February 27, 2009 by Champak Link to comment Share on other sites More sharing options...
Champak Posted February 27, 2009 Author Share Posted February 27, 2009 (edited) I think figured a different way to attack this, to put this: For $I = UBound($POIARRAY) - 1 To 1 Step -1 If _GUICtrlListView_GetItemState($H_LISTVIEW, $i-2, $LVIS_SELECTED) = 2 Then _ArrayDelete($POIARRAY, $i) _GUICtrlListView_DeleteItem($H_LISTVIEW, $i-2) EndIf Next I haven't tested it yet, but I think it should work. EDIT: It does work, I just wish there is a "better" way to do this, because I think this will be slow with a large array/list Edited February 27, 2009 by Champak 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