[Gambas-user] Changing the font in code

Rob sourceforge-raindog2 at ...94...
Sun Aug 15 17:27:52 CEST 2004


On Sunday 15 August 2004 11:22, Michael Sullivan wrote:
> Can anyone give me the syntax for changing a controls font in
> code?  I can't seem to find it in the help system.

You normally need a temporary variable, as the font object 
associated with controls works funny now (it's a "real object" 
according to Benoit, but one you can't actually change unless 
you assign it to another font object.)

DIM tmpfont AS font

tmpfont = myButton.Font
tmpfont.Size = 24
myButton.Font = tmpfont

There is a shortcut syntax to this, which doesn't need a temp 
variable, but it is kind of dumb and you should comment it if 
you use it:

myButton.Font.Size = 24
myButton.Font = myButton.Font

Yeah, I don't get it either.  Hopefully after 1.0 this will get 
changed back to how it originally worked somehow.

Rob





More information about the User mailing list