aleph01 15 Posted April 11, 2011 I'm trying to write a GUI that will allow users to select the content of a listbox. What I have written works to this extent: The GUI displays fine, the radio buttons can be selected, but the content in the listbox remains whatever I set the default content to be. I can change the default content, but I need some kind of loop to get the script to constantly reread the state of the radio buttons and display the appropriate content. I tried a While loop, but the listbox content didn't change from the default when I selected another radio button. Any help would be appreciated, as my mind is now mush from thinking about this for so long... expandcollapse popupFunc _Main() Local $hListBox, $FinishButton, $CancelButton, $rdocu, $rdohp, $rdosf, $gui, $iState, $fEnable ; Create GUI $gui = GUICreate("Select OPACs", 210, 550) $FinishButton = GUICtrlCreateButton("Finish", 4, 490, 120) $CancelButton = GUICtrlCreateButton("Cancel", 126, 490, 80) $rdocu = GUICtrlCreateRadio("CU", 30, 525) $rdohp = GUICtrlCreateRadio("HP", 90, 525) $rdosf = GUICtrlCreateRadio("SF", 150, 525) _GUICtrlButton_SetCheck ($rdocu) GUISetState() Select Case _GUICtrlButton_GetCheck($rdocu) = $BST_CHECKED $hListBox = GUICtrlCreateList("", 2, 2, 396, 496, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_EXTENDEDSEL)) GUISetState() ; Add strings _GUICtrlListBox_BeginUpdate($hListBox) For $i = 1 to 5 _GUICtrlListBox_AddString($hListBox, "CUOPAC" & $i) Next For $i = 1 to 29 _GUICtrlListBox_AddString($hListBox, "CUOPACS" & $i) Next For $i = 1 to 3 _GUICtrlListBox_AddString($hListBox, "CUOPACEC" & $i) Next _GUICtrlListBox_EndUpdate($hListBox) ; Select items While 1 Switch GUIGetMsg() Case $CancelButton Exit Case $FinishButton ExitLoop Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Case _GUICtrlButton_GetCheck($rdohp) = $BST_CHECKED $hListBox = GUICtrlCreateList("", 2, 2, 396, 496, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_EXTENDEDSEL)) GUISetState() ; Add strings _GUICtrlListBox_BeginUpdate($hListBox) For $i = 1 To 32 If $i <10 Then $i = "0" & $i _GUICtrlListBox_AddString($hListBox, "HPOPAC" & $i) Next _GUICtrlListBox_EndUpdate($hListBox) ; Select items While 1 Switch GUIGetMsg() Case $CancelButton Exit Case $FinishButton ExitLoop Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Case _GUICtrlButton_GetCheck($rdosf) = $BST_CHECKED $hListBox = GUICtrlCreateList("", 2, 2, 396, 496, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_EXTENDEDSEL)) GUISetState() ; Add strings _GUICtrlListBox_BeginUpdate($hListBox) For $i = 10 to 12 _GUICtrlListBox_AddString($hListBox, "SFOPACO" & $i) Next For $i = 1 to 12 _GUICtrlListBox_AddString($hListBox, "SFOPACA" & $i) Next For $i = 2 to 6 _GUICtrlListBox_AddString($hListBox, "SFOPACJ" & $i) Next For $i = 1 to 6 If $i = 2 Then $i = "2ADA" _GUICtrlListBox_AddString($hListBox, "SFOPACT" & $i) If $i = "2ADA" Then $i = 2 Next _GUICtrlListBox_EndUpdate($hListBox) EndSelect ; Select items While 1 Switch GUIGetMsg() Case $CancelButton Exit Case $FinishButton ExitLoop Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ; Get text of selected items $aItems = _GUICtrlListBox_GetSelItemsText($hListBox) GUIDelete() EndFunc ;==>_Main Meds. They're not just for breakfast anymore. Share this post Link to post Share on other sites
Melba23 3,455 Posted April 11, 2011 aleph01, You need to look for the radios in a loop - like this: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListBoxConstants.au3> _Main() Func _Main() Local $hListBox, $FinishButton, $CancelButton, $rdocu, $rdohp, $rdosf, $gui, $iState, $fEnable ; Create GUI $gui = GUICreate("Select OPACs", 210, 550) $FinishButton = GUICtrlCreateButton("Finish", 4, 490, 120) $CancelButton = GUICtrlCreateButton("Cancel", 126, 490, 80) $rdocu = GUICtrlCreateRadio("CU", 30, 525) GUICtrlSetState(-1, $GUI_CHECKED) $rdohp = GUICtrlCreateRadio("HP", 90, 525) $rdosf = GUICtrlCreateRadio("SF", 150, 525) $hListBox = GUICtrlCreateList("", 2, 2, 396, 496, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_EXTENDEDSEL)) For $i = 1 To 5 GUICtrlSetData($hListBox, "CUOPAC" & $i) Next For $i = 1 To 29 GUICtrlSetData($hListBox, "CUOPACS" & $i) Next For $i = 1 To 3 GUICtrlSetData($hListBox, "CUOPACEC" & $i) Next GUISetState() While 1 Switch GUIGetMsg() Case $CancelButton, $GUI_EVENT_CLOSE Exit Case $FinishButton ExitLoop Case $rdocu GUICtrlSetData($hListBox, "|") For $i = 1 To 5 GUICtrlSetData($hListBox, "CUOPAC" & $i) Next For $i = 1 To 29 GUICtrlSetData($hListBox, "CUOPACS" & $i) Next For $i = 1 To 3 GUICtrlSetData($hListBox, "CUOPACEC" & $i) Next Case $rdohp GUICtrlSetData($hListBox, "|") For $i = 1 To 32 If $i < 10 Then $i = "0" & $i GUICtrlSetData($hListBox, "HPOPAC" & $i) Next Case $rdosf GUICtrlSetData($hListBox, "|") For $i = 10 To 12 GUICtrlSetData($hListBox, "SFOPACO" & $i) Next For $i = 1 To 12 GUICtrlSetData($hListBox, "SFOPACA" & $i) Next For $i = 2 To 6 GUICtrlSetData($hListBox, "SFOPACJ" & $i) Next For $i = 1 To 6 If $i = 2 Then $i = "2ADA" GUICtrlSetData($hListBox, "SFOPACT" & $i) If $i = "2ADA" Then $i = 2 Next EndSwitch WEnd EndFunc ;==>_Main In principle it is never a good idea to mix native and UDF commands - try to stick with one or the other. Unless you need the functionality of the UDF commands - and then be prepared for it not to work as you think it should. Please ask if anything is unclear. 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 Share this post Link to post Share on other sites
BrewManNH 1,305 Posted April 11, 2011 Here's my interpretation of your script: expandcollapse popup#include <GuiButton.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListBox.au3> _main() Func _Main() Local $hListBox, $FinishButton, $CancelButton, $rdocu, $rdohp, $rdosf, $gui, $iState, $fEnable, $rdocuchk, $rdosfchk, $rdohpchk ; Create GUI $gui = GUICreate("Select OPACs", 210, 550) $FinishButton = GUICtrlCreateButton("Finish", 4, 490, 120) $CancelButton = GUICtrlCreateButton("Cancel", 126, 490, 80) $rdocu = GUICtrlCreateRadio("CU", 30, 525) $rdohp = GUICtrlCreateRadio("HP", 90, 525) $rdosf = GUICtrlCreateRadio("SF", 150, 525) _GUICtrlButton_SetCheck($rdocu) $hListBox = GUICtrlCreateList("", 2, 2, 396, 496, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_EXTENDEDSEL)) GUISetState() While 1 Select Case _GUICtrlButton_GetCheck($rdocu) = $BST_CHECKED And $rdocuchk <> 1 ; Add strings _GUICtrlListBox_BeginUpdate($hListBox) _GUICtrlListBox_ResetContent($hListBox) For $i = 1 To 5 _GUICtrlListBox_AddString($hListBox, "CUOPAC" & $i) Next For $i = 1 To 29 _GUICtrlListBox_AddString($hListBox, "CUOPACS" & $i) Next For $i = 1 To 3 _GUICtrlListBox_AddString($hListBox, "CUOPACEC" & $i) Next _GUICtrlListBox_EndUpdate($hListBox) ; Select items $rdocuchk = 1 $rdohpchk = 0 $rdosfchk = 0 Case _GUICtrlButton_GetCheck($rdohp) = $BST_CHECKED And $rdohpchk <> 1 ; Add strings _GUICtrlListBox_BeginUpdate($hListBox) _GUICtrlListBox_ResetContent($hListBox) For $i = 1 To 32 If $i < 10 Then $i = "0" & $i _GUICtrlListBox_AddString($hListBox, "HPOPAC" & $i) Next _GUICtrlListBox_EndUpdate($hListBox) ; Select items $rdocuchk = 0 $rdohpchk = 1 $rdosfchk = 0 Case _GUICtrlButton_GetCheck($rdosf) = $BST_CHECKED And $rdosfchk <> 1 ; Add strings _GUICtrlListBox_BeginUpdate($hListBox) _GUICtrlListBox_ResetContent($hListBox) For $i = 10 To 12 _GUICtrlListBox_AddString($hListBox, "SFOPACO" & $i) Next For $i = 1 To 12 _GUICtrlListBox_AddString($hListBox, "SFOPACA" & $i) Next For $i = 2 To 6 _GUICtrlListBox_AddString($hListBox, "SFOPACJ" & $i) Next For $i = 1 To 6 If $i = 2 Then $i = "2ADA" _GUICtrlListBox_AddString($hListBox, "SFOPACT" & $i) If $i = "2ADA" Then $i = 2 Next _GUICtrlListBox_EndUpdate($hListBox) $rdocuchk = 0 $rdohpchk = 0 $rdosfchk = 1 EndSelect ; Select items Switch GUIGetMsg() Case $CancelButton Exit Case $FinishButton ExitLoop Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ; Get text of selected items $aItems = _GUICtrlListBox_GetSelItemsText($hListBox) GUIDelete() EndFunc ;==>_Main If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way!I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Share this post Link to post Share on other sites
aleph01 15 Posted April 11, 2011 Thanks, M23. The Main function works flawlessly now, but it appears to handle populating the array of selections differently. I get an "Error: Subscript used with non-Array variable" on line 35: For $sItems = 1 to $aItems[0] with an arrow pointing to the [0]. This line worked fine when I was using a single listbox data set and the UDFs. On the bright side, I can see this is much cleaner code. I wonder, though where you discovered that you could use the pipe in your GUICtrlSetData statement. I didn't see it in the help file. You seem to have magic up your sleeve. Now I want an M23 air-brushed tee shirt, lol. Thanks again for your help. expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GUIListBox.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <Misc.au3> #include <GuiButton.au3> _Singleton("branchSelectOPAC", 0) Opt("MustDeclareVars", 1) Dim $aItems, $sItems, $SourceFile, $ProgNum, $FileCopySuccess, $brSelect, $i If MsgBox(1, "Replace the Screensaver on CUOPACs", "Save your screensaver image, correctly sized, as a bitmap (.bmp extension) directly on your desktop.") = 2 Then Exit While 1 $SourceFile = InputBox("Screensaver Filename", "Type the name of your screensaver file without the extension. Example: Great Decisions", "", "", 300, 130) If @error = 1 Then Exit If Not FileExists("C:\Documents and Settings\" & @UserName & "\Desktop\" & $SourceFile & ".bmp") Then If MsgBox(1, "File Does Not Exist", "Please check your filename and spelling.") = 2 Then Exit Else $SourceFile = ($SourceFile & ".bmp") ExitLoop EndIf WEnd _Main() ProgressOn("Screensaver Transfer Progress","", "", "", "", 18) ProgressSet(0, "", 0 & " %") For $sItems = 1 To $aItems[0] If Not FileExists("\\" & $aItems[$sItems] & "\C$\Program Files\Envisionware\PC Reservation\Client Module\Images\fcplPCres.bmp") Then MsgBox(0, "File Copy Error", "There was an error in copying the screensaver to """ & $aItems[$sItems] & """. Please check that the computer is turned on. Contact IT if you feel you have received this message in error.") Else FileCopy("C:\Documents and Settings\" & @UserName & "\desktop\" & $SourceFile, "\\" & $aItems[$sItems] & "\C$\Program Files\EnvisionWare\PC Reservation\Client Module\images\fcplPCres.bmp", 1) $FileCopySuccess = 1 EndIF $ProgNum = Round ($sItems / $aItems[0] * 100) ProgressSet($ProgNum, "", $ProgNum & " %") Next ProgressSet(100, "", 100 & " %") Sleep(500) ProgressOff() If $FileCopySuccess = 1 Then MsgBox(0, "Screensaver Replacement Completed", "The screensavers on the systems specified have been replaced. A reboot of the systems is required before the new screensavers will display. You may now move the screensaver file from your desktop to where you archive your screensaver files.") Func _Main() Local $hListBox, $FinishButton, $CancelButton, $rdocu, $rdohp, $rdosf, $gui ; Create GUI $gui = GUICreate("Select OPACs", 210, 550) $FinishButton = GUICtrlCreateButton("Finish", 4, 490, 120) $CancelButton = GUICtrlCreateButton("Cancel", 126, 490, 80) $rdocu = GUICtrlCreateRadio("CU", 30, 525) GUICtrlSetState(-1, $GUI_CHECKED) $rdohp = GUICtrlCreateRadio("HP", 90, 525) $rdosf = GUICtrlCreateRadio("SF", 150, 525) $hListBox = GUICtrlCreateList("", 2, 2, 396, 496, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_EXTENDEDSEL)) For $i = 1 To 5 GUICtrlSetData($hListBox, "CUOPAC" & $i) Next For $i = 1 To 29 GUICtrlSetData($hListBox, "CUOPACS" & $i) Next For $i = 1 To 3 GUICtrlSetData($hListBox, "CUOPACEC" & $i) Next GUISetState() While 1 Switch GUIGetMsg() Case $CancelButton, $GUI_EVENT_CLOSE Exit Case $FinishButton ExitLoop Case $rdocu GUICtrlSetData($hListBox, "|") For $i = 1 To 5 GUICtrlSetData($hListBox, "CUOPAC" & $i) Next For $i = 1 To 29 GUICtrlSetData($hListBox, "CUOPACS" & $i) Next For $i = 1 To 3 GUICtrlSetData($hListBox, "CUOPACEC" & $i) Next Case $rdohp GUICtrlSetData($hListBox, "|") For $i = 1 To 32 If $i < 10 Then $i = "0" & $i GUICtrlSetData($hListBox, "HPOPAC" & $i) Next Case $rdosf GUICtrlSetData($hListBox, "|") For $i = 10 To 12 GUICtrlSetData($hListBox, "SFOPACO" & $i) Next For $i = 1 To 12 GUICtrlSetData($hListBox, "SFOPACA" & $i) Next For $i = 2 To 6 GUICtrlSetData($hListBox, "SFOPACJ" & $i) Next For $i = 1 To 6 If $i = 2 Then $i = "2ADA" GUICtrlSetData($hListBox, "SFOPACT" & $i) If $i = "2ADA" Then $i = 2 Next EndSwitch WEnd EndFunc ;==>_Main Meds. They're not just for breakfast anymore. Share this post Link to post Share on other sites
Melba23 3,455 Posted April 11, 2011 aleph01,You get that error becasue you have declared $aItems, but not as an array. So AutoIt has no idea what is in the [0] element to use as a limit for the loop. Did you remove some code which set the value? As to the "|" - just look in the Help file for GUICtrlSetData: For Combo or List control :If the "data" corresponds to an already existing entry it is set as the default.If the "data" starts with GUIDataSeparatorChar or is an empty string "" the previous list is destroyed.I usually go with the "|" to make it clear. 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 Share this post Link to post Share on other sites
aleph01 15 Posted April 11, 2011 BrewManNH, Thanks for the help. I plugged your code into my script and didn't get the subscript error, I got files to copy to domain computers (the overall function of the script), but when I selected three items from each list, only the last listbox items ended up in the array. I saw that you added some additional varaibles, but I haven't looked closely at what you wrote yet. I did see where you ANDed your new variables into statements, but I'm finding it confusing. No surprise, I'm finding everything about writing GUIs confusing. Do you see a way to make the array of selected items include items from all three sets of listbox items? Meds. They're not just for breakfast anymore. Share this post Link to post Share on other sites
aleph01 15 Posted April 11, 2011 M23, I may have mis-moused (is that even a word?) and deleted more that I intended when I copied your code into my script. I'll look it over and post back. Thanks Meds. They're not just for breakfast anymore. Share this post Link to post Share on other sites
aleph01 15 Posted April 11, 2011 M23, I don't see where I changed the code other than the main function. I do remember using _ArrayDisplay($aItems) in trying to get a grasp on what was going on earlier and finding that the subscript [0] item was the number of items selected. The [1] item was the 1st selected item. I tried putting _ArrayDisplay($aItems) into the script just now, but I don't get to view the array, I continue to get the subscript error. Is this one of the UDF/native mismatch errors you mentioned earlier? Meds. They're not just for breakfast anymore. Share this post Link to post Share on other sites
BrewManNH 1,305 Posted April 11, 2011 All those extra variables are doing is preventing the list from flickering. The way I did it, if I had left those off, it would still change the list depending upon which radio button was selected, but it would have flashed like crazy. With them, it only changes the listbox contents when the radio box that is selected changes. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way!I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Share this post Link to post Share on other sites
Melba23 3,455 Posted April 11, 2011 aleph01, Is this one of the UDF/native mismatch errors you mentioned earlier?No, as I explained it is because $aItems is not an array. If you want to access the elements, you need to define them. At present you declare $aItems as a variable (not an array) and never fill it so you have no elements to access. In your previous script you must have filled the array somewhere - it looks like the number of PCs on the network: FileExists("\\" & $aItems[$sItems] & "\C$\Program Files\Envisionware\PC Reservation\Client Module\Images\fcplPCres.bmp") What data do you expect there and how did you get it before? 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 Share this post Link to post Share on other sites
aleph01 15 Posted April 11, 2011 BrewManNH, I see what you did, and I believe you when you say it prevents flickering, but I don't understand why that would be necessary or how it actually works to prevent the flickering. If I were young, I would be wide-eyed with wonder. As it is, I can only claim dementia... btw, is the NH for New Hampshire? I'm a former New Jersey man myself. As for the selections being "lost" when I radio over to another list, I tried selecting from the CU list, selecting the HP list, then going back to the CU list. The items were no longer selected. Does each case need $aItems = _GUICtrlListBox_GetSelItemsText($hListBox) to put the items into the array? Would that result in the next listbox selections being concatenated in the array? Thanks for the help. Meds. They're not just for breakfast anymore. Share this post Link to post Share on other sites
BrewManNH 1,305 Posted April 12, 2011 The way I wrote the function it would be constantly rewriting the listbox contents based on the condition of the radio button unless I put in something that told the script that it has already read that condition and doesn't need to write it again. Once you change the radio button selected, the old listbox contents will be erased and the new values will be written in their place. You will need to store the selected items into an array or some other way to not lose what you have selected, before you change the listbox contents. Or, you will need to process what has been selected and then change to the new values. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way!I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Share this post Link to post Share on other sites