This is a discussion on CEdit Flicker - Programmer ; I, like a fair few before me it looks like, have hit the "flicker" problem that occurs when using SetSel/ReplaceSel to update some text within a CEdit control. In my case I am using CEditView, but, based on what I ...
I, like a fair few before me it looks like, have hit the "flicker"
problem that occurs when using SetSel/ReplaceSel to update some text
within a CEdit control. In my case I am using CEditView, but, based on
what I see in terms of the control's messages, it appears to be an
inherent problem with CEdit itself - whenever you do an update in this
way it causes flicker - there are no PAINT/ERASEBKGND msgs to the
control which can be intercepted or whatever to try and solve this
I see that people have tried to tackle this issue a number of ways but
I see no documented solutions.
The problem doesn't appear to be that bad on the desktop, however, on
PPC is it significant.
Given, that I'm stuck with using CEdit/CEditView for a number of
reasons, I have tried to solve it myself a number of ways with no
success - so far.
What appears to be necessary is to somehow freeze/disable the window's
updates whilst the SetSel/ReplaceSel msgs are being processed. On the
desktop there are facilities like (Un)LockWindowUpdate which can help
but they are not available on PPC. Using the SetRedraw approach doesn't
work since SetRedraw(TRUE) seems to cause flicker itself.
The most promising approach I've come up with (although I haven't got
it working yet is) to place another window on top of the CEdit window
which simply maintains a copy of the CEdit contents. When an update is
to be applied to the CEdit window, we actually place the copy over it,
make the update and then remove the copy. As long as we can eliminate
unnecessary erases during this process then no flicker should occur.
Does this approach sound feasible? Anyone beaten me to it? Any better