Jump to content

Use of ByRef with GUI controls


 Share

Recommended Posts

First post. For a scripting language, AutoIt is a great development tool :whistle:

If I have a GUI label ($label1) and wish to change the font I can say:

GUICtrlSetFont($label1, -1, -1, -1, "Lucida Console")

I can put this in a function and call it:

ChangeFont($label1)

Func ChangeFont(ByRef $nameofctrl)
    GUICtrlSetFont($nameofctrl, -1, -1, -1, "Lucida Console")
EndFunc

So, if I have more than one label ($label1, $label2, $label3, ...) I want to say:

For $i = 1 to 10
    ChangeFont("$label" & $i)
Next

But it seems I can't pass a control (as a string) into the function. How do I do this without having to say:

ChangeFont($label1)
ChangeFont($label2)
ChangeFont($label3)
...
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...