Iterate through controls

In an app I have many labels with a specific font and appearance (italic). Now my customer doesn’t want that font.
Can I iterate through all controls in a Xojo project and change the appearance?

That would save me quite some time (and money)…

I assume you mean at runtime, and not by using Search and Replace in the IDE?


  dim i as integer
dim ctrl as control
  For i=0 To Me.ControlCount-1
      If ctrl IsA Label Then Label(ctrl).Textfont="new font name"
  Next i

Uhhhh… Is it possible on the IDE? Haven’ t tried that yet.

Use Find/Replace if you want to alter the actual code at design time…
use something like above if you want to change it at run time

Thanks Dave!

And if your are about to put hands on your code and do all that work: why don’t you subclass label and make your new ‘mylabel’ class a super of all labels used in your code? Then you can make changes like textfont in one place …