Help! Can't get WM_SETREDRAW to work!


2004-05-08 09:37:34 AM
cppbuilder112
I'm trying to batch the updating of controls on the screen. Basically some
controls are being removed and then recreated and I need to minimize the
'flicker' effect that is created. I created a function to turn on and off
the redrawing of the screen like this: (I'm re-creating from memory)
bool __fastcall SetAutomaticUpdate(bool setAutoUpdate);
{
static bool autoupdate = true;
if(autoupdate != setAutoUpdate)
{
autoupdate = setAutoUpdate;
SendMessage(GetWindow()->Handle, WM_SETREDRAW, (WPARAM)(autoupdate ?
TRUE : FALSE), 0);
if(autoupdate)
GetWindow()->Repaint(); // Also tried InvalidateRec() Windows
API call without success
}
return autoupdate;
}
Basically I have two different types of controls that are getting updated.
One type is a very slightly modified descendent of TLabel. The other is a
slightly modified descendent of TMemo. The TLabel descendents are getting
redrawn from the call to Repaint(), but the TMemo descendents are not
getting updated at all. If I minimize the program and the restore, the
screen refreshes correctly which makes it all the more maddening. I'm using
C++ Builder 6. Any ideas? Any help would be most appreciated.