Image Replace and RVStyles at Runtimie

General TRichView support forum. Please post your questions here
Post Reply
LonelyRanger
Posts: 11
Joined: Sun Jul 23, 2006 6:11 am

Image Replace and RVStyles at Runtimie

Post by LonelyRanger »

Hello,

A couple of questions if you dont mind assisting with please...

1. Quite some time ago I asked a question in regards to Text to Image replacement. The Emotion demo/example helped well. These are limited to 1 character proceeding the : I am looking at using more than one character for the search and replace eg: (emot) instead of :e, is this easily done using the current example code?

2. Also you mentioned in the same post about creating RVStyles dynamically because you cannot change the textstyle property without all the other text that used that style changing its font attributes aswell. So I have it creating a new style for each message coming through which I must say works well to an extent. The RVE kind of flickers bad after I call FormatTail; when the RVE needs to scroll. Usually the flicker will flash the text that was posted just before the RVE started scrolling. Obviously I cannot free the style because it will remove the style properties for text already in the RVE. Anu ideas if dynamically creating these styles would be the cause? If so, what other paths can I take to prevent it.

Thankyou so much for your time.

Cheers.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

1. It's not too difficult to modify this demo to support more codes. The Emoticons demo shows several ways of inserting smiles in chat. Which one you are insterested in?

2. FormatTail must not flicker at all. Any Add*** methods must not flicker as well (because they do not update document at all). Some other method (probably called unnecessary) causes flickering.
As for adding styles. Do you reuse existing styles if possible (using FindSuchStyle or similar method)? Otherwise you will add too many unnecessary duplicate styles.
Method DeleteUnusedStyles deletes all styles that are no longer in use (you need to set Standard property of styles to False, otherwise this methods does not delete them)
LonelyRanger
Posts: 11
Joined: Sun Jul 23, 2006 6:11 am

Post by LonelyRanger »

1. As a message comes through the socket it is formatted then tailed to the end of the RVE. It is just before its posted to the RVE that it needs to check for replacement. I see one example there but it searches and replaces whole document. Could I possibly just somehow make that search and replace on the lastline only?

2. Thanks for response, I will try DeleteUnUsedStyles. Why this question was asked is because its a chat environment and there are literally millions of possible colors that can be used. So in affect, no one style would virtually ever be the same.

Oh, and before I forgot, I need to remove the firstline in the RVE. Eg: TRichEdit was simply RichEdit.Lines.Delete(0); Possible solution please?

Thanks Heaps
Sergey
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

1. Search and replace work only in TRichViewEdit, not in TRichView.
There are no reasons to make chat window usingTRichViewEdit, TRichView is enough.
So, you receive message from socket as a plain text string, and you need to add it to the end of chat window. Is it the same as the second tab of this demo ("From TEdit"), that adds text using AddWithIcons procedure?

2. In any editor, millions possible colors are possible. But only some of them are used, with repetition. So reusing of styles is useful.

Use DeleteParas method. It was designed specially for chat windows, it does not require calling Format or Reformat after.
Post Reply