Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Util/RTF/RTFData Tests
Function:
Required plugins for this example: MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Util/RTF/RTFData Tests
This example is the version from Sat, 22th Nov 2013.
Project "RTFData Tests.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control TextArea1 Inherits TextArea
ControlInstance TextArea1 Inherits TextArea
EventHandler Sub TextChange() if done then run end if End EventHandler
End Control
Control TextArea2 Inherits TextArea
ControlInstance TextArea2 Inherits TextArea
End Control
Control TextArea3 Inherits TextArea
ControlInstance TextArea3 Inherits TextArea
End Control
Control TextArea5 Inherits TextArea
ControlInstance TextArea5 Inherits TextArea
End Control
Control TextArea6 Inherits TextArea
ControlInstance TextArea6 Inherits TextArea
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control Label2 Inherits Label
ControlInstance Label2 Inherits Label
End Control
Control Label3 Inherits Label
ControlInstance Label3 Inherits Label
End Control
Control Label4 Inherits Label
ControlInstance Label4 Inherits Label
End Control
Control Label5 Inherits Label
ControlInstance Label5 Inherits Label
End Control
Control Label6 Inherits Label
ControlInstance Label6 Inherits Label
End Control
Control Label7 Inherits Label
ControlInstance Label7 Inherits Label
End Control
Control TextArea7 Inherits TextArea
ControlInstance TextArea7 Inherits TextArea
End Control
Control Label8 Inherits Label
ControlInstance Label8 Inherits Label
End Control
EventHandler Sub Open() TextArea1.Text = "" TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelText = "Hello World"+EndOfLine TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelText = "Styles: " TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelBold = true TextArea1.SelText = "bold" TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelBold = false TextArea1.SelText = ", " TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelItalic = true TextArea1.SelText = "italic" TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelItalic = false TextArea1.SelText = ", " TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelUnderline = true TextArea1.SelText = "italic" TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelUnderline = false TextArea1.SelText = EndOfLine TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelText = "Fonts: " TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelTextFont = "Arial" TextArea1.SelText = "Arial, " TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelTextFont = "Comic Sans MS" TextArea1.SelText = "Comic Sans MS, " TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelTextFont = "Courier" TextArea1.SelText = "Courier" TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelTextFont = "" TextArea1.SelText = EndOfLine TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelAlignment = TextArea1.AlignLeft TextArea1.SelText = "Left Align"+EndOfLine TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelAlignment = TextArea1.AlignCenter TextArea1.SelText = "Center Align"+EndOfLine TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelAlignment = TextArea1.AlignRight TextArea1.SelText = "Right Align"+EndOfLine TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelAlignment = TextArea1.AlignDefault TextArea1.SelText = "Default Align"+EndOfLine TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelTextColor = &cFF0000 TextArea1.SelText = "Red " TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelTextColor = &c00FF00 TextArea1.SelText = "Green " TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelTextColor = &c0000FF TextArea1.SelText = "Blue"+EndOfLine TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelTextSize = 9 TextArea1.SelText = "Size 9"+EndOfLine TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelTextSize = 12 TextArea1.SelText = "Size 12"+EndOfLine TextArea1.SelStart = TextArea1.Text.Len TextArea1.SelTextSize = 20 TextArea1.SelText = "Size 20"+EndOfLine done = true run End EventHandler
Sub Run() dim RTFData1 as string = TextArea1.StyledText.RTFData TextArea2.Text = RTFData1 TextArea3.StyledText.RTFData = RTFData1 dim RTFData2 as string = TextArea1.StyledText.RTFDataMBS TextArea5.Text = RTFData2 TextArea6.StyledText.RTFDataMBS = RTFData2 if StrCompBytesMBS(RTFData2, RTFData1) = 0 then label6.Text = "Equal" else label6.Text = "Not equal." end if dim RTFData3 as string = TextArea6.StyledText.RTFDataMBS if StrCompBytesMBS(RTFData2, RTFData3) = 0 then label7.Text = "Equal" else label7.Text = "Not equal." end if TextArea7.text = RTFData3 End Sub
Property done As Boolean
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Util Plugin.




Links
MBS FileMaker blog