Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to prevent flicker in richedit?

661 views
Skip to first unread message

Dave

unread,
Jun 13, 1999, 3:00:00 AM6/13/99
to
I'm trying to write a syntax highlighting memo control out of a TRichEdit
control. A problem I'm having is while highlighting a line, the line
flickers. I'm using EM_HIDESELECTION to prevent the highlighting from
showing, but it still flickers.

Is there a way to prevent updates from happening til I'm through? A
freeze() or something?

-dave

Damon Chandler

unread,
Jun 13, 1999, 3:00:00 AM6/13/99
to
Hi Dave,


You can send the RichEdit control the WM_SETREDRAW message, to turn off screen
updating while you select the characters. Here's an example I posted a while
back...

8< - - - - -

//turn off screen updating
RichEdit1->Perform(WM_SETREDRAW, false, 0);

//do your selecting / changing...
//for example...

int start = RichEdit1->SelStart;
int end = start + RichEdit1->SelLength;
for (int index = start; index < end; index++)
{
RichEdit1->SelStart = index;
RichEdit1->SelLength = 1;
RichEdit1->SelAttributes->Style = RichEdit1->SelAttributes->Style << fsBold;
}

//turn on screen updating
RichEdit1->Perform(WM_SETREDRAW, true, 0);

//update display
RichEdit1->Refresh();

8< - - - - -


HTH.

/*---------------------------------*/
Damon Chandler

http://bcbcaq.freeservers.com
Answers to <Commonly Asked Questions>

Dave

unread,
Jun 13, 1999, 3:00:00 AM6/13/99
to
Hello again =)

> You can send the RichEdit control the WM_SETREDRAW message, to turn off
screen
> updating while you select the characters. Here's an example I posted a
while
> back...

Thanks, I'll give that a shot.

-dave

Lazarus2000

unread,
Jun 15, 1999, 3:00:00 AM6/15/99
to
In addition to Damon's suggestion, you could also try the LockWindowUpdate
API call.

Dave <land...@ameritech.net> wrote in message
news:7jvema$ep...@forums.borland.com...


> I'm trying to write a syntax highlighting memo control out of a TRichEdit
> control. A problem I'm having is while highlighting a line, the line
> flickers. I'm using EM_HIDESELECTION to prevent the highlighting from
> showing, but it still flickers.
>
> Is there a way to prevent updates from happening til I'm through? A
> freeze() or something?
>

> -dave
>
>

Stefan Hoffmeister (TeamB)

unread,
Jun 15, 1999, 3:00:00 AM6/15/99
to
: "Lazarus2000" <chipREM...@kj.net> wrote:

>In addition to Damon's suggestion, you could also try the LockWindowUpdate
>API call.

Aaaaaaaahhhhh !! ;-)

Please go to http://www.deja.com/ and have a look at "Hoffmeister
LockWindowUpdate"...

--
Stefan Hoffmeister (TeamB) http://www.econos.de/
Please do apply judgement when sending email.

0 new messages