Sub MAIN

REM Check for attributes on. If on then turn them off. If none
are REM enabled, then enter a user dialog to enable desired
attributes.

REM Set Flags.

TRUE = 1
OFF = 0
Attribute = OFF

REM Check for Bold, Italic and Underline, then Superscript or
Subscript.

If Bold() = TRUE Then
     Attribute = TRUE
     Bold OFF
End If
If Italic() = TRUE Then
     Attribute = TRUE
     Italic OFF
End If
If Underline() = TRUE Then
     Attribute = TRUE
     Underline OFF
End If
If SuperScript() = TRUE Then
     Attribute = TRUE
     Size = FontSize()
     FontSize(Size + 2)
     SuperScript OFF
End If
If SubScript() = TRUE Then
     Attribute = TRUE
     Size = FontSize()
     FontSize(Size + 2)
     SubScript OFF
End If

REM If symbol font is active, return to Tms Rmn

If Font$() = "Symbol" Then
     Attribute = TRUE
     Font "Tms Rmn"
End If

REM If any attributes on, then exit without any user interaction.
Otherwise REM open a dialog box to permit the user to select the
appropriate attributes.

If Attribute = OFF Then
     GetUserInput
Else
     Print "Attributes returned to normal."
End If

End Sub

REM Subroutine for user dialog bos.

Sub GetUserInput

TRUE = 1
OFF = 0

REM Setup dialog box

Begin Dialog UserDialog 355, 120
     Text 79, 2, 198, 12, "Select Text Attributes"
     Text 15, 17, 90, 12,  "Attributes"
     CheckBox 20, 37, 54, 12, "Bol&d", .Bld
     CheckBox 20, 52, 81, 12, "&Italics", .Ital
     CheckBox 20, 67, 99, 12, "&Underline", .Under
     Text  117, 17, 54, 12, "Style"
     OptionGroup .Styl
          OptionButton 122, 37, 72, 12, "&Normal"
          OptionButton 122, 52, 117, 12, "Su&perscript"
          OptionButton 122, 67, 99, 12, "Su&bscript"
     Text 242, 17, 45, 12, "Font"
     OptionGroup .Fnt
          OptionButton 247, 37, 99, 12, "&Unchanged"
          OptionButton 247, 52, 81, 12, "&Tms Rmn"
          OptionButton 247, 67, 72, 12, "&Symbol"
     OKButton 86, 90, 64, 18
     CancelButton 186, 90, 64, 18
End Dialog

REM Do the interactions

Dim dlg As Dialog UserDialog
Dialog dlg

REM Process the results

If dlg.Bld = 1 Then Bold TRUE
If dlg.Ital = 1 Then Italic TRUE
If dlg.Under = 1 Then Underline TRUE
SuperScript OFF
SubScript OFF
If dlg.styl > 0 Then
     If dlg.Styl = 1 Then
          Size = FontSize()
          FontSize(Size - 2)
          SuperScript TRUE
     Else
          Size = FontSize()
          FontSize(Size - 2)
          SubScript TRUE
     End If
End If
If dlg.Fnt > 0 Then
     If dlg.Fnt = 1 Then
          Font "Tms Rmn"
     Else
          Font "Symbol"
     End If
End If

End Sub
