Page 1 of 2

[Demo] Chat codes

Posted: Tue Sep 06, 2005 5:40 pm
by Sergey Tkachenko
1. Simple demo
http://www.trichview.com/support/files/chatcodes.zip

This demo shows how to add text with some codes:
\b - bold on/off
\i - italic on/off
\u - underline on/off
\cRRGGBB - text color
\kRRGGBB - text background color

2. Advanced demo with plain text input
chatcodes2.zip
(7.37 KiB) Downloaded 2549 times
[+] Old version of this demo
https://www.trichview.com/support/files/chatcodes2.zip - for TRichView 17.2 and older)
This demo has almost complete ready-to-use chat window functionality.
In addition to the demo above, it supports the commands:
\f"FONTNAME" - changes font name
\sNN - changes font size to NN points (it's also possible to use one digit \sN followed by non-digit character; if this character is a space, it is not displayed)
This demo supports:
- Emoticons. They can be easily customized, just modify CreateEmoticons procedure. In this demo, bitmaps are used, but you can easily change them to animated gifs.
- URL detection
- message preview as you type.
Image

3. Advanced demo with rich text text input
chatcodeswysiwyg.zip
(10 KiB) Downloaded 2497 times
[+] Old version of this demo
https://www.trichview.com/support/files ... ysiwyg.zip (for Delphi) - for TRichView 17.2 and older)
This demo uses the same commands as the demo above, but the message is typed in TRichViewEdit instead of TEdit.
The demo converts the message to a string (using the codes described above), then this string is parsed and added to the chat window.

[+] History of updates
2008-Dec-11: correction for Delphi 2009
2009-Jun-8: correction for Delphi 2009
2010-Apr-15: the third demo
2018-Apr-12: the demos #2 and #3 are changed for compatibility with TRichView 17.3; fix in color processing

See also:
- Contact list demo http://www.trichview.com/forums/viewtopic.php?p=12608

Posted: Wed Sep 07, 2005 3:46 am
by Guest
so good example.


i can make work with the component TFont dialog

How i can make work like in the demo using the color dialog.?

Thanks

Posted: Wed Sep 07, 2005 9:40 am
by Sergey Tkachenko
This demo already has a button (Button1) allowing choosing color from dialog

Posted: Wed Sep 07, 2005 3:59 pm
by Guest
yes i know.

but i want use the FontDialog. at the same way that in the
demo is using the color dialog


then a button to chose the font, the color., and size.
using the FontDialog.

thanks.

Posted: Fri Sep 09, 2005 6:18 pm
by Sergey Tkachenko
I do not think that using font dialog is a good idea.
Ok, it's possible to add a chat code like \f"Times New Roman".
But there are on/off switches like \b, so font depends on commands which were added in the string before this place.

Posted: Sat Sep 10, 2005 5:56 pm
by Guest
Ho i can do that. ?

add

\f"Times New Roman".

Posted: Sun Sep 11, 2005 7:00 pm
by Sergey Tkachenko
The new version with new \f"FONTNAME" command:
http://www.trichview.com/support/files/chatcodes2.zip

Posted: Tue Sep 13, 2005 7:46 pm
by Guest
checking, the new demo.

Thanks.

Posted: Mon Apr 24, 2006 5:49 pm
by carpii
Thanks Sergey, this is very useful and saved me a lot of time learning how the styles work. I will be purchasing soemtime soon, so thankyou again for this example.

Carpii

Posted: Fri Jun 02, 2006 4:27 pm
by Zepoux
Hello all,

the same with IRC colors

Enjoy

http://f1lzr.free.fr/zip/ircColors.rar

Posted: Thu Mar 13, 2008 11:55 am
by Sergey Tkachenko
http://www.trichview.com/support/files/chatcodes2.zip is updated, see the first post in this topic.

Posted: Thu May 08, 2008 7:45 pm
by aussie
dear sergey is there any way to view youtube video in this chat windows when someone put the link ? if yes could you make a sample ? tx

Posted: Fri May 09, 2008 9:19 am
by Sergey Tkachenko
Sorry, I never worked with youtube video.
If you know a control that can play youtube video, you can insert it in TRichView.

I believe you can use Flash ActiveX, loading Chromeless Player in it. (apiplayer.SWF): http://code.google.com/apis/youtube/chr ... l#Overview

This demo breaks with D2009

Posted: Wed Jun 03, 2009 5:23 pm
by adrennan
This demo breaks with Delphi 2009. Specifically it looks like the AddStringWithURLs is doing math as 1 byte characters.

Posted: Tue Sep 15, 2009 7:27 pm
by Sergey Tkachenko
Sorry for late answer, but I cannot reproduce problems with Delphi 2009.