EndFunc Posted February 18, 2009 Share Posted February 18, 2009 I've been trying to read a list that uses the $LBS_EXTENDEDSEL. When I do a GuiCtrlRead, it only returns the last value selected. What am I missing? How do I return all the values selected in the ListBox? Thanks EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
ReaImDown Posted February 18, 2009 Share Posted February 18, 2009 (edited) I've been trying to read a list that uses the $LBS_EXTENDEDSEL. When I do a GuiCtrlRead, it only returns the last value selected. What am I missing? How do I return all the values selected in the ListBox?Thankshelpfile $Input_Site3_Folder = GUICtrlCreateCombo($exp, 40, 160, 405) GUICtrlSetData(-1, $exp0 & "|" & $exp1 & "|" & $exp2) GUICtrlSetState(-1, 256) Edited February 18, 2009 by ReaImDown [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 18, 2009 Moderators Share Posted February 18, 2009 (edited) EndFunc,I had the same problem a while ago - took ages for the penny to drop! Try holding down the Ctrl key while you select and then use _GUICtrlListBox_GetSelItems .M23Edited because I just realised you were only using GUICtrlRead. Sorry.And again because PsaltyDS beat me to it! Edited February 18, 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...
PsaltyDS Posted February 18, 2009 Share Posted February 18, 2009 I've been trying to read a list that uses the $LBS_EXTENDEDSEL. When I do a GuiCtrlRead, it only returns the last value selected. What am I missing? How do I return all the values selected in the ListBox?ThanksUse _GUICtrlListBox_GetSelItems() helpfile $Input_Site3_Folder = GUICtrlCreateCombo($exp, 40, 160, 405) GUICtrlSetData(-1, $exp0 & "|" & $exp1 & "|" & $exp2) GUICtrlSetState(-1, 256)That only sets $GUI_FOCUS on the control... how does that help? 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...
EndFunc Posted February 18, 2009 Author Share Posted February 18, 2009 You both misunderstood, I already know how to create a list box so I don't need to use the help file for that. thanks, I already know how to do multiple selections, that is a basic windows function. What I was referring to is I am trying to read the control with GuiCtrlRead while I have all multiple selections but it only retrieves the last selected item. I am using an Array to read from an Ini file to populate my listbox which works fine. I can't figure out how to show all the items I have selected using GuiCtrlRead. Output can be a message box , log etc. Doesn't matter about output right now. EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
EndFunc Posted February 18, 2009 Author Share Posted February 18, 2009 Use _GUICtrlListBox_GetSelItems() That only sets $GUI_FOCUS on the control... how does that help? Ah, I will try that. Thanks. EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
EndFunc Posted February 18, 2009 Author Share Posted February 18, 2009 Ok I was able to use _GUICtrlListBox_GetSelItemsText The problem I'm having now is that I can't get the array to reset. If I run it in a while loop and I run the Case again, it will add to the array with the same values. How do I reset it? I tried re delcaring but that didn't work right or i wasn't doing it right. This is the code I am running. Local $ShowItems, $aShowItems, $List1 $ShowItems = _GUICtrlListBox_GetSelItemsText($List1) For $iI = 1 To $ShowItems[0] $aShowItems &= @LF & $ShowItems[$iI] Next MsgBox(0,0, $aShowItems) EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 18, 2009 Moderators Share Posted February 18, 2009 EndFunc,I believe you are looking for _GUICtrlListBox_SetSel - from the Help file: An $iIndex of -1 means to toggle select/unselect of all items (ignores the $fSelect).Although given my previous success rate with this thread, you may wish to ignore this. ;-0M23 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...
PsaltyDS Posted February 18, 2009 Share Posted February 18, 2009 Ok I was able to use _GUICtrlListBox_GetSelItemsText The problem I'm having now is that I can't get the array to reset. If I run it in a while loop and I run the Case again, it will add to the array with the same values. How do I reset it? I tried re delcaring but that didn't work right or i wasn't doing it right. This is the code I am running. Local $ShowItems, $aShowItems, $List1 $ShowItems = _GUICtrlListBox_GetSelItemsText($List1) For $iI = 1 To $ShowItems[0] $aShowItems &= @LF & $ShowItems[$iI] Next MsgBox(0,0, $aShowItems) The array $ShowItems will be replaced with the new selection list, but the string $aShowItems will only get reset if you add a line of code to do it. Something like: $aShowItems = "" Your description and variable naming are confusing the issue. The leading lower case 'a' in a variable name indicates an array by convention, but you are naming a string variable using $aShowItems vice $sShowItems. The actual array has no indication of its type in $ShowItems. To fit with conventions and avoid confusion, I would have done something more like: Local $sShowItems = "", $aShowItems, $List1 $aShowItems = _GUICtrlListBox_GetSelItemsText($List1) For $i = 1 To $aShowItems[0] $sShowItems &= @LF & $aShowItems[$i] Next MsgBox(0,0, $sShowItems) 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...
EndFunc Posted February 18, 2009 Author Share Posted February 18, 2009 The array $ShowItems will be replaced with the new selection list, but the string $aShowItems will only get reset if you add a line of code to do it. Something like: $aShowItems = "" Your description and variable naming are confusing the issue. The leading lower case 'a' in a variable name indicates an array by convention, but you are naming a string variable using $aShowItems vice $sShowItems. The actual array has no indication of its type in $ShowItems. To fit with conventions and avoid confusion, I would have done something more like: Local $sShowItems = "", $aShowItems, $List1 $aShowItems = _GUICtrlListBox_GetSelItemsText($List1) For $i = 1 To $aShowItems[0] $sShowItems &= @LF & $aShowItems[$i] Next MsgBox(0,0, $sShowItems) You are right about that naming. Sorry didn't mean to confuse. I've made my adjustments. EndFuncAutoIt is the shiznit. I love it. 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