Jump to content

Recommended Posts

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

Link to comment
Share on other sites

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?

 

Link to comment
Share on other sites

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

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

20 hours ago, water said:

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

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

Link to comment
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
 Share

×
×
  • Create New...