Page 1 of 1

Disable/EnableWindowRedraw() and Disable/EnableGadgetRedraw(

Posted: Fri Mar 17, 2006 2:40 pm
by Rescator
I'll use working PB code for the example of what I mean here :)

DisableWindowRedraw(window)

Code: Select all

SendMessage_(WindowID(window),#WM_SETREDRAW,#False,0)
EnableWindowRedraw(window)

Code: Select all

SendMessage_(WindowID(window),#WM_SETREDRAW,#True,0)
RedrawWindow_(WindowID(window),#Null,#Null,#RDW_INVALIDATE)
DisableGadgetRedraw(gadget)

Code: Select all

SendMessage_(GadgetID(gadget),#WM_SETREDRAW,#False,0)
EnableGadgetRedraw(gadget)

Code: Select all

SendMessage_(GadgetID(gadget),#WM_SETREDRAW,#True,0)
RedrawWindow_(GadgetID(gadget),#Null,#Null,#RDW_INVALIDATE)
PS! I'm not sure if RedrawWindow_() is correct for use directly on gadgets,
maube a region is needed, but hopefully you understand what I mean here :)

The idea is that one can turn off the redrawing thereby reducing a lot of systems messages while windows with many gadgets are resized etc.

Likewise, for gadgets it is very important.
Esp. gadgets like listviews and similar as they normaly redraw each time you add a item to them.

(adding 50000+ items to a listview is very slow unless redrawing is disabled)