PDA

Click to See Complete Forum and Search --> : rich textbox flickers


MrPolite
Nov 26th, 2002, 12:52 AM
I'm trying to highlight certain keywords AS THE USER TYPES text in a rich textbox. The only way I could think of was to search through the whole textbox everytime the CHANGED event is fired, and then colorize the keywords (which turns out to be really slow).

The problem is that it flickers alot, because I'm selecting and unselecting certain keywords in order to colorize them. I tried the suspendlayout method, but sounds like it doesnt do anything whatsoever

MrPolite
Nov 27th, 2002, 05:45 PM
aah I used the LockWindow API, and it doesnt flicker anymore. But it's extreemly slow. If you start typing a little fast, it wont update the textbox as you type :( what should I do

Edneeis
Nov 27th, 2002, 05:48 PM
Maybe you could thread the highlight code so it doesn't hang the rest of the app.

Negative0
Nov 27th, 2002, 07:25 PM
Another way is to only colorize on enters and spaces because thats really when you want to check words to be colored. Add that to the threading method and you should be ok.

MrPolite
Nov 27th, 2002, 07:38 PM
aah didnt work :(
it makes a big mess. The function that I have is supposed to SELECT a part of the text and then highlight it. If I call it by a thread, then the selected part can be deleted as I'm typing. :(

MrPolite
Nov 27th, 2002, 07:42 PM
Originally posted by Negative0
Another way is to only colorize on enters and spaces because thats really when you want to check words to be colored. Add that to the threading method and you should be ok.

aah works mucho better:D:D thanks

one problem though: how can I find out if the use if pasting something?

MrPolite
Dec 6th, 2002, 12:49 AM
umm so is there a way to find out if the user is pasting something ?

Edneeis
Dec 9th, 2002, 03:59 PM
Maybe in the TextChanged event you could keep a static variable of the last Text.Length then if it increases by more than 1 they probably pasted something in instead of typed it in.

PT Exorcist
Dec 9th, 2002, 04:02 PM
well i didnt read the entire post but sometime ago i saw in assembly page something about this..the guy said that his first attemp was just like u to use the richtextbox and some api's but it got really really slow...so the thing he done was with a regular textbox and some api's..

MrPolite
Dec 9th, 2002, 09:11 PM
:( I guess I should forget it
thanks for helping though