[futurebasic] Re: [FB] Coloured text

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2011 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Sat, 30 Apr 2011 09:28:35 +1200
> This snippet will print text in *red*:
> 
> print "";
> color _zred
> print "blürf!!"
> stop
> 
> while this one will print in *black*:
> 
> color _zred
> print "";'or no command
> print "blürf!!"
> stop
> 
> What's going on?

In FB5, the 'color' statement calls the toolbox function ForeColor() for the current output window.
If there is no front window, 'color' does nothing.
In your examples, the first 'print' statement creates a default window.


To set the color of editable text, use SetButtonFontStyle().

appearance button _textColorField,,,,,, @r, _kControlEditUnicodeTextProc
dim as ControlFontStyleRec  cfs
cfs.flags = _kControlUseForeColorMask
cfs.foreColor.red   = whatever
cfs.foreColor.green = whatever
cfs.foreColor.blue  = whatever
fn SetButtonFontStyle( _textColorField, cfs )

Robert P.