|
Post by rogercabo on Feb 16, 2023 22:56:35 GMT 1
Hi everyone, I know that rtf text box has some issues. Here is an example I made. This program loads a simple text into the rtf1 control. Then selecting all words and mark them as red with underline. > Press [Dict Check] and it takes about 10 seconds on my system to finish.  > Now press [Delselect Text] > Move the right slider down to the end of the and place the cursor to the end. > Then press [Dict Check] again.  Now the whole process tales less than 0.6 seconds only I'm desperately looking for a way to change that ist always fast. HideRedraw(frm1) and ShowRedraw(frm1) have no effect on the display speed. The find word code is superior fast. The words are found in 2ms. i% = 0 _word = DIC_FindNextWord(t$, -1, pos%, len%) // -1=start from 0 While Len(_word$) If DIC_MAIN_Exist(_word) = 1 // underline the word rtf1.SelStart = pos% rtf1.SelLength = len% rtf1.SelUnderline = False rtf1.SelColor = RGB(255, 0, 0) EndIf _word = DIC_FindNextWord(t$, 0, pos%, len%) i++ Wend i--
Any ideas if there is any trick to solve this rtf1 issue? Thank you! DictTest3_GFAForum.G32 (27 KB)
|
|
|
Post by dragonjim on Feb 17, 2023 12:57:58 GMT 1
After a quick look at your code, 1999 out of every 2000 milliseconds is used recreating the RichText file, which is internal Windows stuff which can not be helped.
The only solution I can suggest is to:
1. Load the RTF code into a string. 2. Make your amendments to the string. 3. Reload the string into the RichEdit box.
GFA string management is far superior to Windows so it should be quicker.
|
|
|
Post by rogercabo on Feb 17, 2023 14:03:53 GMT 1
After a quick look at your code, 1999 out of every 2000 milliseconds is used recreating the RichText file, which is internal Windows stuff which can not be helped. The only solution I can suggest is to: 1. Load the RTF code into a string. 2. Make your amendments to the string. 3. Reload the string into the RichEdit box. GFA string management is far superior to Windows so it should be quicker. While I can modify the RTF string directly instead of using the RTF control, doing so causes an issue where the cursor position is lost and the text warps around every time I set a new RTF string in real time while typing in the RTF box. The only way to prevent this is to defocus to another control and then refocus back to the RTF box, but as you might expect, I can't type while this is happening. Unfortunately, it seems that there is no way to simultaneously type and change the color of a word in the RTF box.
Seems there is not way to do a real-time checking and coloring in the RTF Control like in a browser with spellcheck.
|
|