Disable/EnableWindowRedraw() and Disable/EnableGadgetRedraw(

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Disable/EnableWindowRedraw() and Disable/EnableGadgetRedraw(

Post 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)