Jump to content

Resetting List based on option selected


Go to solution Solved by Nine,

Recommended Posts

I have been messing with this listbox and trying to get the listed items to reset based on the option that is selected.  Right now it add the list but when you click on the other option it adds the list again. 

I am looking for a way to reset the list if a new option is selected.  I tried just resetting with $List1 = "" at the start of each Case but it doesnt function as I expected.  I did not see anything in the help file for clearing or resetting the list unless I missed it.

Does anyone know a way to make this work or an alternative option that would do the same thing to populate the list from a text file?

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <GUIListBox.au3>
#include <Array.au3>
#include <File.au3>


#Region ### START Koda GUI section ### Form=\\bjcsccmfr01\osd.files\_ProdTSFiles\OSDFrontEnd-v2\OptionListFormTest.kxf
$Form1 = GUICreate("OptionListForm", 383, 437, 324, 124)
$List1 = GUICtrlCreateList("", 48, 120, 217, 266)
$Option1rdo = GUICtrlCreateRadio("Option 1", 48, 24, 73, 25)
$Option2rdo = GUICtrlCreateRadio("Option 2", 48, 56, 73, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

GLOBAL $sOptionList = @ScriptDir & "\OptionList.txt"
Global $aList
Global $sList

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Option1rdo
            _FileReadToArray($sOptionList, $aList, $FRTA_NOCOUNT)
            $sList = _ArrayToString($aList, "|")
            GUICtrlSetData($List1, $sList, "")
        Case $Option2rdo
            _FileReadToArray($sOptionList, $aList, $FRTA_NOCOUNT)
            $sList = _ArrayToString($aList, "|")
            GUICtrlSetData($List1, $sList, "")
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Thanks,
Trinnon

Link to comment
Share on other sites

  • Solution

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...