Page 1 of 1

Richview autocorrect text smiley

Posted: Sun Jul 27, 2014 5:06 am
by Timoncheg
Good day, dear. I wrote a chat. To display the new rows using Richview.

How to display this whole thing alone I understood, but I struggle with the problem AutoCorrect (in the help did not find anything worthwhile, in Google too). The task at first glance simple:

RichView1.AddNL (incoming messages, 0,0);
/ / Find a substring in this message '! Smile02' and replace the pattern of ImageBox.
RichView1.Format;

I ask your help, who can already faced.

Posted: Sun Jul 27, 2014 12:52 pm
by Sergey Tkachenko
Look at the demo: Demos\DelphiUnicode\Assorted\Graphics\Emoticons.
It shows 3 ways to replace strings with graphics:
- SearchText + InsertBullet. This method is not too useful for chats
- Parsing text string before adding to TRichView
- Detection on typing
The demo above can give an idea, but they are not universal (they can work only with codes :) :( :| )

The more advanced example is here: http://www.trichview.com/forums/viewtopic.php?t=63
It contains almost ready-to use code for adding chat text with URLs and smileys, a set of smiley codes and images is customizable.
The demo uses bitmaps, but it's simple to change them to animates gifs, for example.