Sign in to follow this  
Followers 0
rowish

Related Combos

2 posts in this topic

Hello all,

I intend to create a GUI with two related combo boxes, ie, when one element is selected from the first combo then the second combo will be updated with a specific set of data.

So far, since I have only poor experience with AutoIT, my best attempt is the following code, obviously full of some logical and syntax errors.

CODE
#include <GUIComboBox.au3>

#include <GUIConstants.au3>

Global $CityCode, $LogicIDData ;= "2|3|4|5|6"

GUICreate("Office Information", 256, 164)

GUICtrlCreateLabel("Please select the data in order to retrieve the information.", 8, 8, 256, 40)

$Country = GUICtrlCreateCombo ("ES", 10, 60, 48)

$CountryData = GUICtrlSetData (-1, "IT|PL", "PL")

Func ChangeLogicIDData ()

If GUICtrlRead ($Country, 1) = "ES" Then

$LogicIDData = "2|3|4|5"

ElseIf GUICtrlRead ($Country, 1) = "IT" Then

$LogicIDData = "2|3|4"

ElseIf GUICtrlRead ($Country, 1) = "PL" Then

$LogicIDData = "2|3|4|5|6"

EndIf

EndFunc

$LogicID = GUICtrlCreateCombo ("1", 60, 60, 48)

$LogicIDData = GUICtrlSetData ($LogicID, $LogicIDData, "1")

$Display = GUICtrlCreateButton("Display", 25, 125, 80, 20)

$Exit = GUICtrlCreateButton("Exit", 140, 125, 80, 20)

GUISetState ()

While 1

If $CBN_SELCHANGE = 1 Then

ChangeLogicIDData ()

EndIf

$msg = GUIGetMsg()

Select

Case $msg = $Display

$CountryRead = GUICtrlRead ($Country, 1)

$LogicIDRead = GUICtrlRead ($LogicID, 1)

MsgBox (0, "Information", " " & $CountryRead & " " & $LogicIDRead)

Case $msg = $Exit

GUISetState (@SW_HIDE)

Exit

Case $msg = $GUI_EVENT_CLOSE

GUISetState (@SW_HIDE)

Exit

EndSelect

Wend

I will apreciate any help.

Share this post


Link to post
Share on other sites



Please delete your multiple posts on this same subject.

Do post what you think is not happening with your code as it is.

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