SetRedraw

Description

Controls the automatic redrawing of an object or control after each change to its properties.

Applies to

Any object except a Menu

Syntax

objectname.SetRedraw ( boolean )

Returns

Integer. Returns 1 if it succeeds and -1 if an error occurs. If boolean is null, SetRedraw returns null.

Usage

By default, PowerBuilder redraws a control after each change to properties that affect appearance. Use SetRedraw to turn off redrawing temporarily in order to avoid flicker and reduce redrawing time when you are making several changes to the properties of an object or control. If the window is not visible, SetRedraw fails.

NoteCaution If you turn redraw off, you must turn it on again. Otherwise, problems may result. In addition, if redraw is off and you change the Visible or Enabled property of an object in the window, the tabbing order may be affected.

Examples

Example 1

This statement turns off redraw for lb_Location:

lb_Location.SetRedraw(FALSE)

Example 2

If lb_Location is sorted (lb_Location.Sorted = TRUE), these statements use SetRedraw to avoid sorting and redrawing the list of lb_Location until all the new items have been added:

lb_Location.SetRedraw(FALSE)

lb_Location.AddItem("Atlanta")

lb_Location.AddItem("Boston")

lb_Location.AddItem("Washington")

lb_Location.SetRedraw(TRUE)