| **Navigation:**  [[templates.htm|Templates]] > [[templates by topic.htm|Templates by Topic]] > RTFTextControl >====== RTFAction Code Template ====== | [[tplwizardreport.htm|{{btn_prev_n.gif|Previous page}}]][[templates by topic.htm|{{btn_home_n.gif|Return to chapter overview}}]][[tplcontrolrtfstatusbar.htm|{{btn_next_n.gif|Next page}}]] | | || This code template requires the population of the [[tplcontrolrtf.htm|RTFTextControl]] Control Template. The **RTFAction** code template incorporates special support features for a target TEXT control that is using the RTF attribute. Use this code template with visual controls that identify the action that will be performed (e.g., a Save button to perform a //Save// action).The following Actions, and supported prompts, are documented as follows: **Action** The following actions are supported through the RTFAction code template. Each action provides additional prompts that populate the appropriate methods generated by the underlying class. **//Save//** This action writes the contents of the RTF control to a designated target. The drop list **Mode** specifies whether to write the contents in //RichText// or //PlainText// format. Your default can be either one of these formats, but if you haven't set the default mode in hand code, the default mode specified by the templates is //RichText// format. The** File Name **sets the Save destination. This must be a CSTRING variable that you have defined, and be large enough to accommodate the full file name and path. {{notebox.jpg|NoteBox.jpg}} When switching to //PlainText// Mode, the **AllowFormatChange** method must return TRUE to allow the internal default interface to switch formats from RTF to PlainText. Use the method's embed point, and set the ReturnValue of the method to TRUE: **ReturnValue = TRUE** ** ** **//Load//** The Load action is used to load the contents of an external RTF filename to the target RTF control. The** File Name **sets the target to load. This must be a CSTRING variable that you have defined. ** ****//FindandReplace//** This action is used to launch a search and replace into a designated RTF control. The **Find **value is searched, and the value in the** Replace **by prompt replaces the** Find value **text**.** ** ****//SelectedText//** The **SelectedText** action is used to move the current selected text to an external file name designated in the ** File Name **prompt. ** ****//SetFocus//** The **SetFocus** action is used to simply select an RTF control on a window. This could be useful in windows with multiple tab controls. A button could be used to "hot select" the RTF control.// // // // **//Print//** This action is used to print the current contents of an RTF control. Enter a string or variable name to send the Windows **Job Name** to the Print Engine. Make sure to prepend an exclamation point to the variable name (Example - //!MyPrintJobName//) ** ****//Touch//** The** ****Touch** action is used like Prop:Touched to generate an Accepted event on the RTF control. You can make the action variable by entering a valid expression in the **Expression **prompt. The default value is TRUE. ** ****//Changed//** ** **The** ****Changed** action is used to trigger the other supporting controls (like the status bar and toolbar controls) that a change has occurred, and will prompt the user to save any changes if they have not saved it yet. A value of TRUE (1) will be sent to the variable designated in the **Variable prompt.** Because rich text can include hidden information, the **Changed** Action can return TRUE even if there are no visible changes, and no calls to Touch(TRUE) have been executed.