How Do I Dynamically Create Rich Formatted Text? (Magic xpa 3.x)
Rich Formatted Text, or RFT, is basically just a text markup language, like HTML or XML. Therefore, you can move the formatted text to a variable, and it will be displayed by Magic xpa with the fonts and colors you would expect.
The user can edit an RTF field at runtime by using options on the right-click menu. For most applications, you only need to provide the RTF field on the form, and the user will format the data. If you need to initialize the field, you can initialize it with some simple text by must using an Init with some alpha data. Or you can use the Default Value property of the variable.
However, if you want to, you can initialize the field with nice formatted text, as shown in this example. Here we have some RTF text that is held into a text field. When the user presses the button, an Update operation copies the value into a BLOB field, as shown below.
You don’t need to do anything special to move the text into a BLOB field. You can use an Update operation or an Init, or use an expression in the control’s Data property.
To have the Blob display on the form, select the RTF Text edit control, or set up the BLOB variable with the GUI Display property = Rich Edit.
Hint: You do not need to learn a lot about the RTF syntax to use it. Just edit an RTF Blob in Magic xpa, then use Blb2File() to save the Blob in a text file. You can cut and paste the results.
The Online and Rich Client Samples projects (program HG31 and RHG31)