Syntax 1: For windows – PB Docs 2017

Syntax 1: For windows

Description

Closes a window and releases the storage occupied by the window
and all the controls in the window.

Applies to

Window objects

Syntax

Argument

Description

windowname

The name of the window you want to
close

Return value

Integer.

Returns 1 if it succeeds and -1 if an error occurs. If
windowname is null, Close returns null. The return value is usually not
used.

Usage

Use Syntax 1 to close a window and release the storage occupied by
the window and all the controls in the window.

When you call Close, PowerBuilder removes the window from view,
closes it, executes the scripts for the CloseQuery and Close events (if
any), and then executes the rest of the statements in the script that
called the Close function. Do not call Close from the CloseQuery or
Close events, since this produces an endless loop.

After a window is closed, its properties, instance variables, and
controls can no longer be referenced in scripts. If a statement in the
script references the closed window or its properties or instance
variables, an execution error will result.

Closing a window by calling the Close function in any of the
window’s events or in an event of any control on the window can cause
PowerBuilder to crash if the Close function is not the last statement in
the event script. You can avoid this issue by calling the Close function
in the last statement of the event script, or in a user-defined event
that is posted from the event script. For example, the following code in
the Open event script for a window called w_1 can cause a crash:

This code does not cause a crash:

Preventing a window from closing

You can prevent a window from being closed with a return code of
1 in the script for the CloseQuery event. Use the RETURN
statement.

Examples

These statements close the window w_employee and then open the
window w_departments:

After you call Close, the following statements in the script for
the CloseQuery event prompt the user for confirmation and prevent the
window from closing:

See also

Hide

Open


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x