Jump to content

Dependent Combo


Recommended Posts

is it possible to create a combo box whose values are dependent on a previous combo selection?

if this has been done before could someone point me there i did a search but didnt see anything.

Link to comment
Share on other sites

maybe

#include <GUIConstants.au3>

GUICreate("My GUI") ; will create a dialog box that when displayed is centered

$combo1 = GUICtrlCreateCombo ("", 10,10)

GUICtrlSetData(-1,"item1|item2|item3", "item3")

$combo2 = GUICtrlCreateCombo ("", 10,70)

GUISetState ()    ; will display an empty dialog box with a combo control with focus on

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    
    If $msg = $combo1 Then
        $info = GUICtrlRead($combo1)
        If $info = "item1" Then
            GUICtrlSetData($combo2,"")
            GUICtrlSetData($combo2,"item1A|item1B|item1C", "item1A")
        ElseIf $info = "item2" Then
            GUICtrlSetData($combo2,"")
            GUICtrlSetData($combo2,"item2A|item2B|item2C", "item2A")
        ElseIf $info = "item3" Then
            GUICtrlSetData($combo2,"")
            GUICtrlSetData($combo2,"item3A|item3B|item3C", "item3A")
        Else
            GUICtrlSetData($combo2,"")
        EndIf
    EndIf
Wend

8)

NEWHeader1.png

Link to comment
Share on other sites

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...