Sign in to follow this  
Followers 0
ICANSEEYOU7687

A drop down list that depends on a drop down list?

3 posts in this topic

#1 ·  Posted (edited)

ive been playing with this for a while, and how I see it you would need a while loop and an if statement

But in a nutshell I need to create two drop down lists, and depending on what you select in the first drop down list, will change what is in the second

$Combo_2 = GUICtrlCreateCombo("Side", 30, 150, 130, 21)
GUICtrlSetData($Combo_2, "North|South")

$Combo_3 = GUICtrlCreateCombo("", 200, 150, 130, 21)
While 1
    Local $x = GUICtrlRead($Combo_2)
    If $x == "North" Then
    GUICtrlSetData($Combo_3, "test68|test62")
    endif

(sorry for the crudeness, but this is just something that I through together real quick to give a general idea what I was thinking. But its been a while since I coded and I Know theres a better way of going about this... but the while loop will create a lot of entries in the drop down list for some reason... not what I want at all lol

So any advice would be great!

Love these forums by the way

Edited by ICANSEEYOU7687

Share this post


Link to post
Share on other sites



I got this and it works... but it seems very inefficient?

any ideas?

$Combo_2 = GUICtrlCreateCombo("Side", 30, 150, 130, 21)
GUICtrlSetData($Combo_2, "North|South")
$Combo_3 = GUICtrlCreateCombo("", 200, 150, 130, 21)
$BOK = GUICtrlCreateButton("Create User", 8, 300, 121, 33)
$BCancel = GUICtrlCreateButton("Cancel", 628, 300, 73, 33, BitOR($GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON))
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###
Local $a = 0
Local $b = 0

While 1
    Local $NorthOrSouth = GUICtrlRead($Combo_2) 
    If $NorthOrSouth == "North" Then
        if $a == 0 Then
        GUICtrlSetData($Combo_3, "")
        GUICtrlSetData($Combo_3, "test68|test62")
        $a = 1
        $b = 0
    endif
EndIf
        If $NorthOrSouth == "South" Then
            if $b == 0 Then
        GUICtrlSetData($Combo_3, "")
        GUICtrlSetData($Combo_3, "test1|test00")
        $b = 1
        $a = 0
    Endif
endif
    

    $nMsg = GUIGetMsg()
    If $combo_2 == "North" Then
    GUICtrlSetData($Combo_3, "test68|test62")
    endif

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  
Followers 0