Jump to content

Incrementing Variable Names & data for GUICtrlCreateRadio & Checkbox

Recommended Posts



I am creating a GUI with options for tests. As this script grows I keep updating, changing and adding checkboxes and radio buttons. I started out manually incrementing the location of the controls like so:

; Create Log Level Radio Buttons
    $bSelect1 = GUICtrlCreateRadio("Info Level Logging.", 10, 10)
    $bSelect2 = GUICtrlCreateRadio("Error Level Logging.", 10, 40)
    $bSelect3 = GUICtrlCreateRadio("Debug Level Logging.", 10, 70)

After about 20 Radio buttons and checkboxes this gets a bit unwieldy.

I would like to replace the "Left" and "Top" numbers with variables like $iL1, $iT1 & $iL2, $iT2

$bSelect1 = GUICtrlCreateRadio("Info Level Logging.", $iL, $iT1)
    $bSelect2 = GUICtrlCreateRadio("Error Level Logging.", $iL, $iT2)
    $bSelect3 = GUICtrlCreateRadio("Debug Level Logging.", $iL, $iT3)

Then I would like to increment the $iTx by 30

I have searched the forums and Internet and have not found anything that makes sense to me. Granted, I am not a programmer; just a Validation Engineer with enough programming experience to write simple scripts. Any help would be appreciated.

Something like:

Local $iT1 = 10, $iT2, $iT3, $iT4, $iT5, $iT6, $iT7, $iT8, $iT9, $iT10, $iT11, $iT12, $iT13, $iT14, $iT15, $iT16, $iT17, $iT18, $iT19, $iT20, $iInc

for $iInc = 2 to 20
    $iT & $iInc = $iT & $iInc +30

where this adds $iInc to $iT to equal $iT1, and assign +30 to that variable so I end up with $iT1 = 10, $iT2 = 40, $iT3 = 70, etc.

Is this possible?

Edited by Jibberish

Share this post

Link to post
Share on other sites

Sure. Do the creation of Radios in a loop and store the resulting ControlIDs in an array.
An example (which could be modified to your needs) can be found here:


My UDFs and Tutorials:


Active Directory (NEW 2017-04-18 - Version - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version - Download - General Help & Support

ADO - Wiki


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


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.