| **Navigation:**  [[templates.htm|Templates]] > Guide to all Templates > Control Templates >====== RTFTextControl Control Template ====== | [[tplcontrolrtfstatusbar.htm|{{btn_prev_n.gif|Previous page}}]][[templates.htm|{{btn_home_n.gif|Return to chapter overview}}]][[tplcontrolrtftoolbar.htm|{{btn_next_n.gif|Next page}}]] | | || The RTFTextControl control template provides built-in RichEdit support for native TEXT controls. In previous releases, support for Rich Text Format was provided in a special and detailed set of special support templates. This new RTFTextControl allows for easy integration of RTF support into all of your applications, with additional code and control template support through the [[tplcontrolrtftoolbar.htm|RTFToolbar]], [[tplcontrolrtfstatusbar.htm|RTFStatusBar]], and the [[tplcodertfaction.htm|RTFAction Code Template]]. {{notebox.jpg|NoteBox.jpg}} This template (and its associated support templates) replaces the RTF Control template, and its associated extension and code template support. In essence, this template simply adds a TEXT control to your window, with the [[rtf declare text control as richedit .htm|RTF]] attribute applied. It also uses a //Field// as the RTF **Value Mode **parameter. {{tipbox.jpg|TipBox.jpg}} The normal design flow of the new RTF text control support is as follows: 1.Populate the RTFTextControl 2.Populate the RTFToolbar 3.Populate the StatusBar 4.Add the RTFAction Code template to additional control and event embed points if needed. **Context Menu** The Context Menu interface allows you to construct custom menu items to add to the existing popup menu used with the RTF control. You can select from a list of actions to attach to each menu item that you create. Press the appropriate button to add (**Insert**), modify (**Properties**), or remove (**Delete**) a context menu item. The following options are available or the subsequent dialog. **Is a separator?** Check this box if you would like to add a separator line to your context menu. There are no other prompts associated with this action. **Menu Text** Enter the name of the context menu item to display. **When Pressed** //No Special Action// The menu item will have no template-generated action associated with it. This option normally is used when you are using an embed point to control this menu's action. //Execute Routine// Enter a valid **Routine Name **here. Of course, you must have the ROUTINE defined within the scope of this procedure. //Post Event to Control// Select a valid Field Equate from the drop list to post an event to the **Control. **Select an //Accepted// or //Selected//** Event **to post to the control from the drop list provided. //Call a Procedure// The RTF Context Menu interface uses the standard interface for calling a procedure. If you need more detailed help here, see the following [[tplcodecallprocedureextended.htm|topic]]. //Run a Program// The RTF Context Menu interface uses the standard interface for running a program. If you need more detailed help here, see the following [[tplcodecallprocedureextended.htm|topic]]. {{tipbox.jpg|TipBox.jpg}} You can translate the contents of the default popup menu items by using the //ContextMenuTranslate// method //Parent Call// embed point as shown below: {{rtfcontextmenutranslate.jpg|RTFContextMenuTranslate.jpg}} The exact texts of standard (default) items of the standard RTF control context menu are as follows: **&Undo** **Copy** **Cut** **&Paste** **Delete** **Select &all** **Insert object...** **Paste special...** Example code added to //ContextMenuTranslate //Parent Call: **!This example only translates three menu items** **  CASE CLIP (pMenuText)** **  OF 'Cut'** **    RETURN 'Move'** **  OF 'Copy'** **    RETURN 'Duplicate'** **  OF '&Paste'** **    RETURN 'Paste Clipboard'** **  ELSE** **    RETURN ''** **  END** **Classes** The Classes tab lets you control the classes (and objects) your procedure uses to accomplish the template's task'that is, they override the global class settings specified in the **Global Properties** dialog. You may accept the default Application Builder Class specified in the **Global Properties** dialog (recommended), or you may specify your own or a third party class to override the default setting. Deriving your own class can give you very fine control over the procedure when the standard Application Builder Class is not precisely what you need. **Object Name** Set the object's label for the template-generated code. **Use Default Application Builder Class?** Check this box to use the default Application Builder Class specified in the **Global Properties** dialog. Clear this box to use a class other than the default, and to enable the following prompts. **Use Application Builder Class?** Check this box to select a class from the **Base Class** drop-down list. The list includes all classes with the LINK attribute in \LIBSRC\*.INC files. Clear this box to specify a class declared elsewhere. **Base Class** If you checked the **Use Application Builder Class?** box, select a class from the drop-down list. If you cleared the **Use Application Builder Class?** box, type the class label here, and type the name of the source file that contains the class declaration in the **Include File** entry box. **Include File** If you cleared the **Use Application Builder Class?** box, type the class label in the **Base Class** entry box, and type the name of the source file that contains the class declaration here. **Derive?** Check this box to derive a class based on the parent class specified above and to enable the **New Class Methods** and **New Class Properties** buttons to define any //new //properties and methods for the derived class. This prompt is primarily to allow you to define //new //properties and methods in a derived class. To override //existing //methods, simply embed code in the corresponding method embed points. Using **Derive?**, **New Class Methods** and **New Class Properties** makes the template generate code similar to the following: **MyProcess CLASS(Process) !derive a class from the parent class** **NewMethod PROCEDURE !prototype new class method** **NewProperty BYTE !declare new class property** **END** {{tipbox.jpg|TipBox.jpg}} **The template automatically derives from the parent class if you embed code into any of the derived method embed points, regardless of the status of this check box.** **New Class Methods** Press this button to specify the //new //method prototypes to generate into the derived CLASS structure. This opens the **New Class Methods **dialog (see //New Class Methods//). **New Class Properties** Press this button to specify the new property declarations to generate into the derived CLASS structure. This opens the **New Class Properties** dialog (see //New Class Properties//). **Application Builder Class Viewer** Press this button to display classes, properties, and methods used by the ABC Templates, and the relationships between parent and derived (child) classes. This utility can help you analyze and understand the classes that the ABC Templates use. **Refresh Application Builder Class Information** Press this button if you have changed the contents of an include file (.INC) or added an include file to the \LIBSRC directory. Typically, this is needed when you install third party products that use ABC compliant classes, although you may create your own ABC compliant classes too. See //ABC Compliant Classes// for more information. The ABC Templates use information gleaned from the header files for generating embed points, loading the Application Builder Class Viewer, application conversion, etc. **Composite Class** Press these buttons to open a Classes dialog for each class used by the parent class specified above. For example, the WindowManager uses a Toolbar class, so the WindowManager's Classes dialog contains a Toolbar Class button to open a Classes dialog for its Toolbar Class.