urtfeditbox (RichEditBox)
The urtfeditbox
widget is used to display and edit text as Rich Text Format (RTF), which supports formatting such as font and color
attributes, text alignment, indentation, and lists. Uniface provides a logical widget called RichEditBox, which is mapped to urtfeditbox
RichEditBox with complete toolbar
For more information, see Specifying a Widget for a Field or Entity.
Logical widget name: | RichEditBox |
Maps to physical widget: |
|
Default definition: | RichEditBox=urtfeditbox(font=editfont;dimmedbackcolor=off;toolbar=font,textcolor,attribute)
|
Use for: | String fields |
Supported triggers: | trigger valueChanged when the field is edited |
Supported properties: | See Widget Properties |
Supported in egrid (Grid) widget? |
No |
Supports MSAA? : | Yes, for testing purposes only. For more information, see Accessibility. |
Description
The urtfeditbox
widget enables you to edit and
store RTF data. Data can be inserted into the widget from a number of sources and the user can
format the text as bold, italic, or underline using the keyboard.
The widget supports enhanced text manipulation using an integrated toolbar. For example, you can change the font, font size, and color, indent text, and create bulleted lists. You can determine whether the toolbar is displayed and what its contents are using the widget's properties.
The urtfeditbox
supports the following
functionality, with some restrictions:
Functionality | Description | Restrictions |
---|---|---|
Keyboard Interaction | Insert, modify, and find text using native Windows keys and Uniface keyboard functions. See Keyboard Interface. | If a key combination is used by both Windows and Uniface, the Native Keyboard setting determines which is used. |
Text Formatting | Apply Bold, Italic, and Underline to text using Ctrl+B, Ctrl+I, and Ctrl+U. | The Ctrl key combinations can differ per application, depending on the keyboard table and the accelerator key definitions in the .ini file. |
Clipboard | Insert text and RTF data from the clipboard | Images are not supported |
Drag and Drop | Drag text and RTF data into the widget from a Windows source | Images are not supported |
Undo and Redo | Undo and redo changes using Ctrl+Z and
Ctrl+Y; only if Native Keyboard is set to True . |
To zoom a field, you must use GOLD Z or MACRO "^Zoom". |
Find and Replace | Find and replace text in the field using the standard Windows dialog boxes. Find functionality can be activated using F8 and Find Next using Shift+F8. | |
Unicode | RTF supports the Unicode and can display all different type of chars within one control. | Tooltips in the toolbar are English only. |
Images | If images are copied, dragged, or assigned to the Rich Edit Box field, they are ignored. | Images are not supported |
Fields that use the Rich Text Edit widget must
have Data Type String and Field Interface ShorthandC*
.
Caution: Do not use field syntax codes such as LOW, UPC,
and so on for fields that use the urtfeditbox
widget. They are not compatible with RTF data and
can result in data loss.
Widget Properties
The rich edit box widget does NOT support the standard color properties for widgets because the text displayed may contain colors that are not visible on the chosen background color.
Property | Technical name | Dynamic? |
---|---|---|
3-D Effect (3d) | 3D | No |
Attach to Window Border (attach) | Attach | Yes |
Auto Select (autoselect) | AutoSelect | Yes |
Automatic Word Wrap | WordWrap | No |
Bottom Line (BottomLine) | BottomLine | Yes |
Double-Click (DblClk) | DblClk | Yes |
Draw 3-D Frame Outside (DrawOutside) | DrawOutside | No |
Dynamic | Dynamic | Yes |
Extended Auto Select (XAutoSelect) | XAutoSelect | Yes |
Frame | Frame | No |
Horizontal Scroll Bar | Hscroll | No |
Label Font (LabelFont) | LabelFont | Yes |
Multiline | Multiline | No |
Native Key | NativeKey | No |
No Display Character | NoDisplay | Yes |
Toolbar | Toolbar | No |
Vertical Scroll Bar (VScroll) | Vscroll | No |
Widget Font (Font) | Font | Yes |
Attach Margin (AttachMargin) | AttachMargin | Yes |
Popup Rectangle (PopupRect) | PopupRect | Yes |
Screen vs. Print Fonts
Some fonts that can be used in the urtfeditbox
widget must have a different size defined for displaying and printing. For example, the bar-code 39
font cannot be used 1:1 on the printer.
;usys.ini [printer] barcodefont=bar-code 39,12,regular [screen] barcodefont=bar-code 39, 48
Assigning and Changing Values
The field value consists of RTF data. Although it
is possible to assign plain text to a urtfeditbox
widget, as soon as the data in the field is
changed, the data is formatted as RTF.
For example, assume that the field MyTextField
contains the string My name is John
. This can be assigned to the rich text field
MyRTFField:
MyRTFField = MyTextField
The data is displayed in the widget using the predefined font and color, which can be set using $fieldproperties or in the widget property form. If the data is edited, it is converted to RTF:
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\froman\fcharset0 Arial;}} {\colortbl ;\red0\green255\blue255;} \viewkind4\uc1\pard\cf1\f0\fs20 My name is Johnny \par }
Although it is technically possible to compare the
values of the two fields (for example, if (MyRTFField = MyTextField)
), it can
only evaluate to true as long as the rich text field has not been changed.
Keyboard Interface
The following Uniface functions are supported by
the urtfeditbox
widget. Only those that are specific to this widget or that can be switched using
the in particular and the functions which can be influenced by the NativeKey
property are listed. All other functions supported by the standard edit widget are also available.
In the following table, the last column indicates whether the function
can be switched using the NativeKey
property, which redirects Ctrl key
combinations.
Function |
Description |
Switchable? |
---|---|---|
^REM_FILE |
Save the field content as an RTF file after user has supplied a correct filename |
No |
^INS_FILE |
Insert a text or RTF file, removing existing data from the widget. User has to supply a correct filename |
No |
^ZOOM |
Zooms field |
Yes Ctrl+Z can be redirected to Undo. |
^QUICK_ZOOM |
Zooms the field to the full screen |
Yes |
^ACCEPT |
Terminates zoom mode and accepts changes |
Yes Ctrl=A can be redirected to Select All. |
^QUIT |
Terminates zoom mode and discards changes after confirmation. |
No |
^FINDREPLACE |
Starts the Find and Replace dialog box of the widget |
Yes Ctrl+H can be redirected to the native Windows function Replace. |
^PROFILE |
Starts the Find dialog box of the widget |
Yes Ctrl+F can be redirected to the native Windows function Find. |
^BOLD |
Applies Bold formatting to the current selection. If the selection is empty, the character formatting is applied to the insertion point, and the new character format is in effect only until the insertion point changes. |
No |
^ITALIC |
Applies Italic formatting to the current selection, as for ^BOLD. |
No |
^UNDERLINE |
Applies Underline formatting to the current selection, as for ^BOLD. |
No |