change textfont

Claus Dreischer claus at dreischer.de
Fri Jan 4 15:17:17 EST 2008


Thanks Mark,

that did the trick!

For later reference (someone searching the eMail archives),
this is the function i use now:

ON change_font new_font
    -- replaces all fonts on every control on every stack
    put the short name of the topstack  into my_topstack
    REPEAT WITH n = 1 to the number of controls in stack my_topstack
        set the textfont of control n to new_font
    END repeat
    
    put the substacks of stack my_topstack into my_substacks
    REPEAT FOR each line my_sub in my_substacks
        REPEAT WITH n = 1 to the number of controls in stack my_sub
            set the textfont of control n of stack my_sub to new_font
        END repeat
    END repeat
END change_font


Regards,
   Claus.




----- original Nachricht --------

Betreff: Re: change textfont
Gesendet: Fr, 04. Jan 2008
Von: Mark Smith<mark at maseurope.net>

> Claus, you need the 'control' keyword:
> 
>   repeat with n = 1 to the number of controls in this stack
>          set the textfont of control n of this stack to "someFont"
>   end repeat
> 
> Best,
> 
> Mark
> On 4 Jan 2008, at 14:44, Claus Dreischer wrote:
> 
> > Hi,
> >
> > i'm looking for an elegant way to change the font used everywhere  
> > in all stacks, fields, buttons, etc. of a programm.
> >
> > I can't use "repeat for each" because it will only work on chunktype,
> > not on fields or buttons.
> >
> > Does anyone have a elegant function for this?
> > I would like not to use something like
> >
> > on change_font my_new_font
> >    set the textfont of btn "button_1" of stack "stack_1" to  
> > my_new_font
> >    set the textfont of btn "button_2" of stack "stack_1" to  
> > my_new_font
> >    ...
> > end change_font





More information about the use-livecode mailing list