Jump to content

Recommended Posts

Posted

Hello All, 

Am looking for code/example for au3 windows GUI for drop down list. for ex - If user select Country from the dropdown list, on the second dropdown list it should list States similarly on the 3rd dropdown list it should list all the city based on the previous dropdown list. 

Using hard coded Array list for Country, State and City.

It should dynamically refresh the form and the list based on the previous dropdown list.

This is for thickclient window form. Kindly help me with the au3 script. thanks.

Posted

I updated the GUICtrlCreateCombo example script to what I think you are looking for.

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("Example", 300, 200)

    ; Create a combobox control.
    Local $idComboBox = GUICtrlCreateCombo("", 10, 10, 185, 20)
    GUICtrlSetData(-1, "|Antartica|Canada|United States", "")
    Local $idComboBox2 = GUICtrlCreateCombo("Item 2", 10, 40, 185, 20)

    Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25)


    ; Display the GUI.
    GUISetState(@SW_SHOW, $hGUI)

    Local $sComboRead = ""

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $idButton_Close
                ExitLoop

            Case $idComboBox
                Switch GUICtrlRead($idComboBox)
                    Case "United States"
                        GUICtrlSetData($idComboBox2, "|New York|Ohio")
                    Case "Canada"
                        GUICtrlSetData($idComboBox2, "|Ontario|Quebec")
                    Case Else
                        GUICtrlSetData($idComboBox2, "|")
                EndSwitch
                ControlCommand($hGUI, "", $idComboBox2, "ShowDropDown", "")

        EndSwitch
    WEnd

    ; Delete the previous GUI and all controls.
    GUIDelete($hGUI)
EndFunc   ;==>Example

 

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
×
×
  • Create New...