Forum > RichMemo

TRichMemo and quick updating of colors. Possible?

(1/2) > >>

MortenB:
I recently started to experiment a bit with colors in the text in a TRichEditBox.
I first add the text, and then I need to do some colors.
My method for doing this is : rmSource.SetRangeColor(wPos, wLen,clGreen)
where "rmSource" is the name of my RichEditBox.
At first glance, this works flawlessly, but even on a short text (like the top two lines here) where I want to do some 20-30 different colorings, this begins to take a noticeable amount of time. Sometimes in my RichEditBox, there will be up to 1000 words, and to do the coloring I want, it takes about 5 seconds.
Anybody aware of a method to increase the speed? or another EditBox which is a lot quicker and gives the ability to change font style and color quickly?
As a bottom line. My wPos and wLen -variables are straight out of an Index, so this is as fast as it can be.
On a text with 1000 words, I do approx 100 000 calculations and comparisons in less than a second. I find it so strange that it takes 5 seconds just to add a little bit of color  >:D

skalogryz:
I presume you're talking about Win32?

The slowness comes from the code that tries to identify what ranges of styles you've in the selected range. Win32 doesn't provide any quick API in order to do that.

...hmm, maybe we could speed it up for you a bit.

skalogryz:
r4377 is ready for you, sir.

It should be slightly faster than 5 seconds.

tk:
You could try http://tkweb.eu/en/delphicomp/kmemo.html
It has very good support for mass formatting changes (update locking).
Plus it has fast methods to add text blocks and colorize them etc.

skalogryz:

--- Quote from: tk on October 12, 2015, 10:30:34 pm ---You could try http://tkweb.eu/en/delphicomp/kmemo.html
It has very good support for mass formatting changes (update locking).
Plus it has fast methods to add text blocks and colorize them etc.

--- End quote ---
And it's free license. beautiful!

Navigation

[0] Message Index

[#] Next page

Go to full version