Sign in to follow this  
Followers 0
boogieoompa

Combo Box Array Question

2 posts in this topic

Does anybody know how to display an array in a combo box I figured this would work (I also tried referencing the function by $ComboBox) but it was a no go.

Any help wpuld be great,

Thanks

Dim $Combobox[10]
$ComboBox[0] = "test 1"
$ComboBox[1] = "test 2"

GuiCtrlCreatecombo("Test1", 10, 100, 130, 100)
GUICtrlSetData(-1,$ComboBox,"Test1")

Share this post


Link to post
Share on other sites



Dim $MyArray[3]
$MyArray[1] = 'Light'
$MyArray[2] = 'Bulb'

$Main = GUICreate('Main', 200, 100)
$Combo = GUICtrlCreateCombo('', 10, 10, 180, 100)
$Button = GUICtrlCreateButton('Populate Combo', 50, 40, 100, 30)

GUISetState()

While 1
    $MSG = GUIGetMsg()  
    If $MSG = - 3 Then Exit
    If $MSG = $Button Then 
        GUICtrlSetData($Combo, PopulateComboArray($MyArray))
    EndIf
WEnd

Func PopulateComboArray($nArray)
    Local $ReturnComboValue = ''
    For $i = 1 To UBound($nArray) - 1
        $ReturnComboValue = $ReturnComboValue & $nArray[$i] & '|'
    Next
    Return StringTrimRight($ReturnComboValue, 1)
EndFunc


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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