[Use-revolution] Re: Button + Field Fonts etc.

Jeanne A. E. DeVoto jeanne at runrev.com
Thu Nov 22 13:06:04 EST 2001


At 4:22 AM -0800 11/19/2001, Rolf Kocherhans wrote:
>I like to mimic every OS as best as I can. Therefore I like to
>display Button on MacOS9 in Charcoal 12 point and on MacOSX in Osaka
>13 point (Sounds strange but looks best (I know it should be Lucida
>Grande)).
>
[...]
>So I thought that I can go similar to this:
>
>  if the platform is "MacOS" and the systemVersion is "9.2.1" then
>     set the textFont of for all buttons  to "Charcoal"
>     set the textSize of for all buttons to 12
>  end if
>
>This would be very easy ... I know it is not possible but maybe there
>is something like a defaultText or similar ?

If a button or field doesn't have a textFont set, it inherits the textFont
of the card it's on (or of the group it's in, if the button or field is
part of a group). If a card doesn't have a textFont set, it inherits from
the stack it's in. (textSize, textStyle, and textColor work similarly.) So
you can use something like this in a preOpenStack handler:

  if the platform is "MacOS" and the systemVersion is "9.2.1" then
    set the textFont of this stack to "Charcoal"
    set the textSize of this stack to 12
  end if

This sets the default font and size throughout the stack. (Please note that
this sets the font for fields as well as buttons, so if you want fields to
have a different font and size, you'll need to either set the textFont and
textSize of each field individually - because an object's own setting
overrides the font inherited from further in the object hierarchy - or set
the textFont and textSize of groups containing the fields.)

(Ken's suggestion of using the templateButton and templateField would be
better for some things, but here I think it's better to set the stack's
font properties instead. This will mean the property is set in a single
place, so it's simpler to change it again. And it applies automatically to
any new fields or buttons you create.)

--
Jeanne A. E. DeVoto ~ jeanne at runrev.com
http://www.runrev.com/
Runtime Revolution Limited - Power to the Developer!





More information about the use-livecode mailing list