[Gambas-user] How to address a text label created by code?

Rob sourceforge-raindog2 at ...94...
Thu Jan 24 22:21:39 CET 2008


On Thursday 24 January 2008 15:57, M0E Lnx wrote:
> I've tried to set the font.bold = false but I can't find a way to
> address the other text labels...

I was about to reply to your thread again on linuxbasic.net, but I 
guess I'll put it here for posterity. There are a couple ways to do 
this.

Probably the easiest way is to create an array of Object at startup 
and add each label to it as you create the label.  Then you can just 
go, for example, FOR EACH l IN myLabels and turn bold off that way.

If you'd rather not create an array, you need to loop through the 
form's controls and turn bold off for each of them.  If you don't 
want to be turning bold off on all the other controls besides your 
labels, you'll need to set the Tag property on each label that you 
add, and check that property when looping through the controls to 
determine if you should turn bold off or not.

Rob




More information about the User mailing list