Initializing the JadeRichText Control

When you insert or paste the JadeRichText control onto a form in the JADE Painter, it is not running in a mode that allows text to be entered in the control. Use the JadeRichText class initialContent property, accessed from the Properties dialog, to initialize the control.

If the text of this property starts with a valid RTF header sequence (for example, "{\rtf"), the RTF reader loads that text when the form is run. All other text is displayed as plain text.

Although you would normally type the text with which the control is initialized into the Properties dialog initialContent property in the JADE Painter, this requires you to have some knowledge of RTF codes (that is, control words and symbols). For details about using the Properties dialog, see "Maintaining Properties for Your Form or Control", later in this chapter.

You could use the JadeRichText control itself to supply the RTF string, by performing the following actions.

  1. Create another form (for example, TempRTF) containing a JadeRichText control and a Button control.

  2. Add the following code to the click event of the Button control of the TempRTF form.

    begin
        // rtfControl is value of the name property for the RTF control
        app.copyStringToClipboard(rtfControl.selTextRTF);
    end;
  3. In the JADE Painter, run the second form (TempRTF, in this example) and then enter the text, formatting it to meet your requirements.

  4. When the appearance of the control meets your requirements, press Ctrl+A to select all text and then click the form button. The click event then copies the selection to the clipboard as encoded text that contains RTF control words and symbols.

  5. In the Properties dialog for the RTF control on your original form, press Ctrl+V in the initialContent text box so that the RTF text string, including its control words and symbols, is then displayed.