HighGuy Posted November 2, 2005 Share Posted November 2, 2005 Hi, I have multiple listboxes in my GUI. If I click on one of them I want the others to be unselected/not marked. How can I achieve this? I did not find anything with GUICtrlSetStat(). TIA, HighGuy Link to comment Share on other sites More sharing options...
LxP Posted November 3, 2005 Share Posted November 3, 2005 (edited) Gary/CyberSlug's GUIList.au3 UDF library offered in this thread should help you out with this.Edit: Actually, I believe that this is included with the beta version of AutoIt, although the copy on offer at the thread linked above is more up-to-date. Edited November 3, 2005 by LxP Link to comment Share on other sites More sharing options...
HighGuy Posted November 3, 2005 Author Share Posted November 3, 2005 Gary/CyberSlug's GUIList.au3 UDF library offered in this thread should help you out with this.Yes, I already had a look at GUIList.au3, but the function that would help me with my problem (_GUICtrlListSetSel) is unfortunately only valid for multi-selection list boxes .The only solution I have at the moment is to refill the list with no default selection given to GUICtrlSetData().Any other ideas? Link to comment Share on other sites More sharing options...
LxP Posted November 4, 2005 Share Posted November 4, 2005 The thread linked above contains some discussion about a _GUICtrlListSelectIndex() function.Use this message only with single-selection list boxes.You cannot use it to set or remove a selection in a multiple-selection list box.To me, this implies that you may be able to use it to remove a selection in a single-selection list box. I would suggest giving it a try with some non-existent index (like -1) and observing the result; Gary would most likely be happy to offer advice to you in that thread if he doesn't see this one. Link to comment Share on other sites More sharing options...
HighGuy Posted November 4, 2005 Author Share Posted November 4, 2005 The thread linked above contains some discussion about a _GUICtrlListSelectIndex() function.Indeed it works with _GUICtrlListSelectIndex($h_listbox, -1) . Thank you for the hint Alex and thank you Gary for this new function! Maybe it would make sense to create a new funtion _GUICtrlListUnSelect($h_listbox) that uses this call. Link to comment Share on other sites More sharing options...
blademonkey Posted November 10, 2005 Share Posted November 10, 2005 I'm getting the following error(s) when I include the Guilist from the beta.C:\Program Files\AutoIt3\Include\guilist.au3(385,37) : ERROR: DllStructCreate(): undefined function. Local $p = DllStructCreate ($RECT)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^C:\Program Files\AutoIt3\Include\guilist.au3(390,90) : ERROR: DllStructGetPtr(): undefined function. Local $ret = GUICtrlSendMsg($h_listbox, $LB_GETITEMRECT, $i_index, DllStructGetPtr ($p)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^C:\Program Files\AutoIt3\Include\guilist.au3(392,26) : ERROR: DllStructDelete(): undefined function. DllStructDelete ($p)~~~~~~~~~~~~~~~~~~~~~~~~~^C:\Program Files\AutoIt3\Include\guilist.au3(395,58) : ERROR: DllStructGetData(): undefined function. Local $array = StringSplit(DllStructGetData ($p, $left)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^C:\WINNT\Profiles\scott_lawrence\Desktop\GUIWrapper.au3 - 4 error(s), 0 warning(s)I'm not using any functions from it at the moment. I've narrowed it down to guilist.au3, because I get the same error when it's just a blank au3 file with the only the include line.Please advise.Thanks. ---"Educate the Mind, Make Savage the Body" -Mao Tse Tung Link to comment Share on other sites More sharing options...
Valuater Posted November 10, 2005 Share Posted November 10, 2005 (edited) are you running the beta version of Autoit3http://www.autoitscript.com/forum/index.ph...pic=10256&st=0#????8) Edited November 10, 2005 by Valuater Link to comment Share on other sites More sharing options...
blademonkey Posted November 10, 2005 Share Posted November 10, 2005 are you running the beta version of Autoit3http://www.autoitscript.com/forum/index.ph...pic=10256&st=0#????8)yes, i just reinstalled it and did a alt+f7 in scite.same errors ---"Educate the Mind, Make Savage the Body" -Mao Tse Tung Link to comment Share on other sites More sharing options...
strate Posted May 11, 2006 Share Posted May 11, 2006 (edited) The _GUICtrlListSetSel() method to unselect in the list box isn't working for me. Here's an example: #include <GUIConstants.au3> #include <GuiList.au3> GLOBAL $MESSAGE = "The following buttons have been clicked" GUICreate("My GUI list"); will create a dialog box that when displayed is centered $add=GUICtrlCreateButton ("toggle", 10,150,75,25) Dim $ADDRESS_LIST = GUICtrlCreateList('', 10, 10, 145, 105,BitOR($WS_BORDER,$WS_VSCROLL,$LBS_MULTIPLESEL,$LBS_DISABLENOSCROLL)) ;~ GUICtrlSetLimit(-1,200); to limit horizontal scrolling GUICtrlSetData(-1,'This|Doesnt|work|for|me') ;~ $close=GUICtrlCreateButton ("my closing button", 64,160,175,25) GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select case $msg = $add _GUICtrlListSetSel($ADDRESS_LIST,0) EndSelect WendAny ideas as to why? Edited May 11, 2006 by strate INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station... Link to comment Share on other sites More sharing options...
hushpuppy Posted May 26, 2012 Share Posted May 26, 2012 _GUICtrlListBox_SetCurSel($Listbox, -1) Link to comment Share on other sites More sharing options...
AndreyS Posted December 13, 2015 Share Posted December 13, 2015 Tell me, please, how to reset the selection, if the property is used ListBox $LBS_EXTENDEDSELSo many functions for working with ListBox, but there is no function deselect all selected items. _GUICtrlListBox_SetCurSel($Listbox, -1)This method unfortunately does not work with multiple choice.Thanks. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 14, 2015 Moderators Share Posted December 14, 2015 AndreyS,Get the list of selected items and deselect them individually:#include <GUIConstantsEx.au3> #include <GuiListBox.au3> $sText = "A|B|C|D|E|F|G|H|I|J|K|L|M" $hGUI = GUICreate("Test", 500, 500) $cList = GUICtrlCreateList("", 10, 10, 300, 300, $LBS_EXTENDEDSEL) GUICtrlSetData($cList, $sText) $cUnSel = GUICtrlCreateButton("UnSel", 10, 450, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cUnSel $aSel = _GUICtrlListBox_GetSelItems($cList) For $i = 1 To $aSel[0] ConsoleWrite($aSel[$i] & @CRLF) _GUICtrlListBox_SetSel($cList, $aSel[$i], False) Next EndSwitch WEndM23  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...
AndreyS Posted December 14, 2015 Share Posted December 14, 2015 Well, yes, if there is no special function then the only way.Thank Melba32, for the tip! Link to comment Share on other sites More sharing options...
DickG Posted January 21, 2016 Share Posted January 21, 2016 On 12/14/2015 at 7:52 AM, Melba23 said: AndreyS, Get the list of selected items and deselect them individually: #include <GUIConstantsEx.au3> #include <GuiListBox.au3> $sText = "A|B|C|D|E|F|G|H|I|J|K|L|M" $hGUI = GUICreate("Test", 500, 500) $cList = GUICtrlCreateList("", 10, 10, 300, 300, $LBS_EXTENDEDSEL) GUICtrlSetData($cList, $sText) $cUnSel = GUICtrlCreateButton("UnSel", 10, 450, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cUnSel $aSel = _GUICtrlListBox_GetSelItems($cList) For $i = 1 To $aSel[0] ConsoleWrite($aSel[$i] & @CRLF) _GUICtrlListBox_SetSel($cList, $aSel[$i], False) Next EndSwitch WEnd M23 Fantastic! Thanks Melba! I was stumped trying to do this. 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