Blog
All Blog Posts | Next Post | Previous PostRevealing a new chat component for Delphi
Tuesday, February 7, 2023
We recently released a new update of TMS FNC UI Pack v5.0 introducing the syntax highlight memo. But that's not all, alongside quite a significant amount of fixes and improvements, we also added a second new component: TTMSFNCChat, a component capable of displaying chat messages in a typical left/right layout, with lots of customization options. Here is an overview of the most important features. No, this blog is not written by ChatGPT. It's written by someone who puts lots of effort and care in components and blog posts, to be enjoyed by you: our valuable customer.
Based on a TTMSFNCTableView
The TTMSFNCChat is based on the TTMSFNCTableView, it exposes a set of features already available such as the look & feel of the items, touch scrolling and many more. In the object inspector, you'll see properties related to TTMSFNCTableView classes. Additionally, there are a couple of events exposed for customization of the messages.
Left / right look and feel
When dropping the TTMSFNCChat on the form, you'll notice that there is a sample discussion with left and right messages. The default properties to control a message are separated in the DefaultLeftItem & DefaultRightItem properties. Additionally, you can configure each message separately.
Built-in editor with attachment button
Included in the TTMSFNCChat is a ready to use built-in editor with optional attachment button. The additional button calls a separate event, and allows you to implement code to pick a file, such as with the TOpenDialog. The editor automatically takes on the height of the text when typing.
Image/File support
The TTMSFNCChat has support for automatically adding images and files. The first code snippet adds an image of a car logo.
TMSFNCChat1.AddImage('Alfa Romeo.png', 'Hi did you see my new car? It''s an Alfa Romeo', cmlLeft);
The second code snippet adds a file, the file name and a message.
TMSFNCChat1.AddFile('MyDrive:\path\Meeting.docx', 'Meeting.docx', 'Hi, attached is a summary of our meeting from this morning', cmlLeft);
Clicking on the file URL will automatically open the file.
Emoticon support
Typing a message with emoticon shortcuts will automatically detect and convert them. There is a basic set that's supported for automatic conversion, the others are based on the operating system. Currently, FMX will convert them to actual images. VCL will render them as characters in the same font size, color and name.
What's next?
Here at TMS, we are hard at work at the next set of features for the following component sets: TMS FNC UI Pack, TMS FNC Cloud Pack & TMS FNC Maps. Stay tuned for more!
Pieter Scheldeman
This blog post has received 3 comments.
No, there is no audio or video support. We''ll investigate the possibilities
Pieter Scheldeman
Is there an option to format program code within the chat item (highlighting)?
Ariel Halasz
All Blog Posts | Next Post | Previous Post
Do it support audio/video ?
Espejel Tafoya Job