Jump to content

Incrementing Variable Names & data for GUICtrlCreateRadio & Checkbox


Jibberish
 Share

Recommended Posts

Hi,

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
Next

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

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...