Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Button Font Style

257 views
Skip to first unread message

Doug

unread,
Jan 23, 1999, 3:00:00 AM1/23/99
to
In attempting to change the TBitBtn Font Style at run-time the fsBold
gets an 'Incompatible types' diagnostic:

i.e. BitBtn1.Font.Style := fsBold;

Style: TFontStyles and the fsBold is a TFontStyle. How can the code
be presented to work around this?

Thanx, Doug Eilertson


Roland Spencer

unread,
Jan 23, 1999, 3:00:00 AM1/23/99
to
The font.style property is a set property, so must be enclosed in braces.

i.e. BitBtn1.Font.Style := [fsBold];

At runtime you can also make changes with arithmetic operators. For
instance :

BitBtn1.Font.Style := BitBtn1.Font.Style + [fsBold, fsItalic]; (adds bold
and italics to the font style)
BitBtn1.Font.Style := BitBtn1.FontStyle - [fsBold]; (removes bold from the
style property)


Doug <doug...@icomnet.com> wrote in message
news:36A8F369...@icomnet.com...

Deborah Pate

unread,
Jan 23, 1999, 3:00:00 AM1/23/99
to
Doug wrote in message <36A8F369...@icomnet.com>...

>In attempting to change the TBitBtn Font Style at run-time the fsBold
>gets an 'Incompatible types' diagnostic:
>i.e. BitBtn1.Font.Style := fsBold;
>Style: TFontStyles and the fsBold is a TFontStyle. How can the code
>be presented to work around this?


TFontStyle is an enumerated type, and TFontStyles is a set (of the
TFontStyle type). So you can use the Include procedure, or just

BitBtn1.Font.Style := BitBtn1.Font.Style + [fsBold];

HTH
Deborah Pate

Peter Below (TeamB)

unread,
Jan 23, 1999, 3:00:00 AM1/23/99
to
> In attempting to change the TBitBtn Font Style at run-time the fsBold
> gets an 'Incompatible types' diagnostic:
>
> i.e. BitBtn1.Font.Style := fsBold;
>
> Style: TFontStyles and the fsBold is a TFontStyle. How can the code
> be presented to work around this?

BitBtn1.Font.Style := [fsBold];

Font.Style is a set so you have to assign it as set of TFontstyle.
Removing a specific style element is done this way:

BitBtn1.Font.Style := BitBtn1.Font.Style - [fsBold];

Assigning an empty set ([]) will remove all font styles and leave a
"plain" font.

Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitely requested!


0 new messages