Jump to content

Recommended Posts

Posted

hello Comunity i am new to autoit and i bump into a pitfall regarding the creation of objects in a dinamyc way but more especific  creating combobox at runtime

i need many comboboxes and sofar i createdthem manually 

like this 

$idCombo_1 = GUICtrlCreateCombo("", 500, 40, 130, 21)
    $idCombo_2 = GUICtrlCreateCombo("", 500, 70, 130, 21)
    $idCombo_3 = GUICtrlCreateCombo("", 500, 100, 130, 21)
    $idCombo_4 = GUICtrlCreateCombo("", 500, 130, 130, 21)
    $idCombo_5 = GUICtrlCreateCombo("", 500, 160, 130, 21)
    $idCombo_6 = GUICtrlCreateCombo("", 500, 190, 130, 21)
    $idCombo_7 = GUICtrlCreateCombo("", 500, 220, 130, 21)
    $idCombo_8 = GUICtrlCreateCombo("", 500, 250, 130, 21)
    $idCombo_9 = GUICtrlCreateCombo("", 500, 280, 130, 21)

    GUICtrlSetData($idCombo_1, "Item1|Item2|Item3|Item4|Item5")
    GUICtrlSetData($idCombo_2, "Item1|Item2|Item3|Item4|Item5")
    GUICtrlSetData($idCombo_3, "Item1|Item2|Item3|Item4|Item5")
    GUICtrlSetData($idCombo_4, "Item1|Item2|Item3|Item4|Item5")
    GUICtrlSetData($idCombo_5, "Item1|Item2|Item3|Item4|Item5")
    GUICtrlSetData($idCombo_6, "Item1|Item2|Item3|Item4|Item5")
    GUICtrlSetData($idCombo_7, "Item1|Item2|Item3|Item4|Item5")
    GUICtrlSetData($idCombo_8, "Item1|Item2|Item3|Item4|Item5")
    GUICtrlSetData($idCombo_9, "Item1|Item2|Item3|Item4|Item5")

now i need this example but create them at runtime as there are more than 9 combos what i need thanks in advance kind regards

Posted

You can certainly create an array to hold the "objects" (autoit controlIDs) of the comboboxes, but you'll still want a way to uniquely reference them later.  

There are a few ways I can think of to do that; for example, keep a table (array or scripting dictionary) with ID/handle and unique ID pairs, or unique variable names for each combobox instance with the value set to the comboxbox ID/handle.

Can you give an example scenario on what you are looking to build?

 

Posted

In this thread we discussed how to create GUI objects dynamically from an INI-file:

 

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
  On 8/2/2017 at 5:20 AM, water said:

In this thread we discussed how to create GUI objects dynamically from an INI-file:

Expand  

Speaking of using an INI, here's another example.

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
×
×
  • Create New...