[Demo] Chat codes

Demos, code samples. Only questions related to the existing topics are allowed here.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

[Demo] Chat codes

Post 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 2528 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 2471 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
Last edited by Sergey Tkachenko on Thu Apr 15, 2010 12:17 pm, edited 7 times in total.
Guest

Post 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
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

This demo already has a button (Button1) allowing choosing color from dialog
Guest

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Guest

Post by Guest »

Ho i can do that. ?

add

\f"Times New Roman".
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

The new version with new \f"FONTNAME" command:
http://www.trichview.com/support/files/chatcodes2.zip
Guest

Post by Guest »

checking, the new demo.

Thanks.
carpii
Posts: 2
Joined: Mon Apr 24, 2006 5:44 pm

Post 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
Zepoux
Posts: 1
Joined: Fri Jun 02, 2006 4:23 pm

Post by Zepoux »

Hello all,

the same with IRC colors

Enjoy

http://f1lzr.free.fr/zip/ircColors.rar
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

http://www.trichview.com/support/files/chatcodes2.zip is updated, see the first post in this topic.
aussie
Posts: 5
Joined: Thu May 08, 2008 7:41 pm

Post 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
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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
adrennan
Posts: 2
Joined: Fri Jan 06, 2006 9:22 pm

This demo breaks with D2009

Post by adrennan »

This demo breaks with Delphi 2009. Specifically it looks like the AddStringWithURLs is doing math as 1 byte characters.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry for late answer, but I cannot reproduce problems with Delphi 2009.
Post Reply