rvchat TRVChat

Properties   Methods   Events

<< Click to display table of contents >>

rvchat TRVChat

Properties   Methods   Events

This component is designed for displaying a chat with the ability to add, edit, and delete messages, as well as reply to them. Messages can include attached images or files. This is a non-visual component that links to a TRichView component and controls its content and rendering.

Unit [VCL/FMX] RVChat / fmxRVChat.

Syntax

TRVChat = class(TComponent)

Hierarchy

TObject

TPersistent

TComponent

How to Use

To make the chat look visually appealing, the borders of lines and areas should be smoothed. For the FireMonkey version on mobile platforms, it is recommended to use Skia4Delphi. For the VCL and Lazarus versions, it is recommended to enable rendering with GDI+ (for Delphi XE2+, include RVGDIPlusGrIn unit in "uses" of your unit; for Lazarus, include RVGDIPlusGrInLaz).

Assign a value to ChatRichView the TRichView component into which messages will be added.

Assign the desired values to the properties that affect the chat's appearance, and then call the AddStyles method (this must be done before starting to use the chat).

Fill the chat’s Users collection.

Add messages one by one using AddMessage method.

Handle clicks on the chat and assign HighlightedMessage.

Using HighlightedMessage, implement message editing, replying, quoting, and deletion:

editing: ChangeMessageText;

replying and quoting: use TRVChatMessageExtraQuote object in the next AddMessage;

deletion: DeleteMessage or MarkMessageAsDeleted

The instructions above cover the most basic actions available in the chat. To explore the capabilities, see the descriptions of properties, methods, and events, as well as the demo project in Assorted\Chat\ folder.

Important information

The chat is intended for on-screen display. You should not attempt to print ChatRichView to a printer.

A special document item type, TRVChatFileItemInfo, is used to display a file attached to a message (StyleNo = rvsChatFile).

Each message is a single paragraph that may include line breaks. The chat automatically detects URLs in the text.

Limitation

The chat drawing does not work properly in Lazarus for Linux, because its canvas does not have necessary methods (you will see outlines instead of filled figures).