Jump to content
Sign in to follow this  
Hammer

radio button controlling list in combo box

Recommended Posts

I have a radio button group and a drop down combo box. I would like the items in the combo box to change when a different radio button is selected. I can't seem to figure out the logic to do this.

Any hints?

Thanks,

Hammer

Share this post


Link to post
Share on other sites

Hi

Try this !

The most important thing is to add the default separator before the item list

"|"

"|item1|item2|item3"

#include <GUIConstants.au3>

$Form1 = GUICreate("Form1", 633, 447, 193, 125)
$Radio1 = GUICtrlCreateRadio("Radio1", 64, 56, 89, 41)
$Radio2 = GUICtrlCreateRadio("Radio2", 64, 120, 89, 49)
$Radio3 = GUICtrlCreateRadio("Radio3", 64, 192, 129, 81)
$Combo1 = GUICtrlCreateCombo("Combo1", 176, 344, 257, 25)
GUICtrlSetData(-1,"item1|item2|item3", "Combo1")
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Radio1
            GUICtrlSetData($Combo1, "|item1|item2|item3", "item1")
        Case $Radio2
            GUICtrlSetData($Combo1,"|item1|item2|item3", "item2")
        Case $Radio3
            GUICtrlSetData($Combo1,"|item1|item2|item3", "item3")
        Case $Combo1
    EndSwitch
WEnd

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...