[futurebasic] Re: [FB] Text Formatting question

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2005 : Group Archive : Group : All Groups

From: Stu Cram <stu@...>
Date: Wed, 16 Nov 2005 18:59:19 -0600
This is a good situation for a (global) variable that keeps track of 
the style(s) in effect. (Each style is represented by one bit within 
the variable.) By using the XOR operator in the CASE instructions, each 
appropriate bit in that variable can be turned on or off like switches. 
Then a single TEXT statement afterward will set the combination of 
styles.

// Put this in Globals...
DIM gMyStyle%

// Do this when the program starts ti initialize it (style plain)
gMyStyle% = 0

// Do the following ...
// ( Not sure what you base your selection on - menu item names? or a 
text value? )
SELECT something$
   CASE "BOLD":       gMyStyle% = gMyStyle% XOR _boldBit%
   CASE "ITALIC":     gMyStyle% = gMyStyle% XOR _italicBit%
   CASE "UNDERLINE" : gMyStyle% = gMyStyle% XOR _ulineBit%
   CASE "EXTEND" :    gMyStyle% = gMyStyle% XOR _extendBit%
   CASE "OUTLINE" :   gMyStyle% = gMyStyle% XOR _outlineBit%
   CASE "SHADOW" :    gMyStyle% = gMyStyle% XOR _shadowBit%
   CASE "CONDENSE" :  gMyStyle% = gMyStyle% XOR _condenseBit%
END SELECT

// Now change the resultant overall style for future printing...
TEXT , , gMyStyle%

If you are using a menu to make the style selection, then you should 
set/clear the check mark on the correct menu item also. See 'DEF 
CheckOneItem' in the Help files to do this. That'll be a task for you 
to figure out.

Hope this helps.
-Stu

====================================================
On Nov 16, 2005, at 6:03 PM, Brian Heibert wrote:

> Hi,
> I got a question:
>
> CASE "BOLD": TEXT ,,_boldBit%
> CASE "ITALIC": TEXT ,,_italicBit%
> CASE "UNDERLINE" : TEXT ,,_ulineBit%
> CASE "EXTEND" : TEXT ,,_extendBit%
> CASE "OUTLINE" : TEXT ,,_outlineBit%
> CASE "SHADOW" : TEXT ,,_shadowBit%
> CASE "CONDENSE" : TEXT ,,_condenseBit%
>
> When I type in one of the above in my editor
> in the output window it changes from lets say boldbit% to italicbit%
> instead of being both bold & italic
> What if I want it to be both?
>
> Brian