Displaying and Editing Text in a Memo Control

From RAD Studio
Jump to: navigation, search

Go Up to Displaying a Single Record

TDBMemo is a data-aware component - similar to the standard TMemo component - that can display lengthy text data. TDBMemo displays multi-line text, and permits a user to enter multi-line text as well. You can use TDBMemo controls to display large text fields or text data contained in binary large object (BLOB) fields.

By default, TDBMemo permits a user to edit memo text. To prevent editing, set the ReadOnly property of the memo control to True. To display tabs and permit users to enter them in a memo, set the WantTabs property to True. To limit the number of characters users can enter into the database memo, use the MaxLength property. The default value for MaxLength is 0, meaning that there is no character limit other than that imposed by the operating system.

Several properties affect how the database memo appears and how text is entered. You can supply scroll bars in the memo with the ScrollBars property. To prevent word wrap, set the WordWrap property to False. The Alignment property determines how the text is aligned within the control. Possible choices are taLeftJustify (the default), taCenter, and taRightJustify. To change the font of the text, use the Font property.

At runtime, users can cut, copy, and paste text to and from a database memo control. You can accomplish the same task programmatically by using the CutToClipboard, CopyToClipboard, and PasteFromClipboard methods.

Because the TDBMemo can display large amounts of data, it can take time to populate the display at run time. To reduce the time it takes to scroll through data records, TDBMemo has an AutoDisplay property that controls whether the accessed data should be displayed automatically. If you set AutoDisplay to False, TDBMemo displays the field name rather than actual data. Double-click inside the control to view the actual data.

See Also