|
<< Click to display table of contents >>
|
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)
TObject
TPersistent
TComponent
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.
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.
Availability
Delphi and C++Builder 10.3 and newer.
By default, TRVChat uses Google Material Symbols and Icons for icons of attached files.
Google Material Symbols and Icons are licensed under the Apache License, Version 2.0 (the "License");
You may not use them except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. |
If you do not agree, you can use TRVChat without attached files, or provide your own icons.
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).