Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Declaring instances of windows – PB Docs 70 – PowerBuilder Library

Declaring instances of windows – PB Docs 70

Declaring instances of windows

Because a window is actually a data type, you can declare
variables of that data type, just as you can declare integers, strings,
and so on. You can then refer to those variables in code.

For example:

declares a variable named mywin of type w_employee.

note.gif Limitation of using variables When you declare a window instance, you cannot reference it
from another window. For example, if there are three windows open,
you cannot explicitly refer to the first one from the second or
third. There is no global handle for windows opened using reference
variables. To maintain references to window instances using a script,
see “Using window arrays”.

Opening an instance

To open a window instance, you refer to the window variable
in the Open function:

Here the Open function determines that the data type of the
variable mywin is w_employee. It then creates an instance
of w_employee and assigns a reference to the mywin variable.

If you code the above script for the Clicked event for a CommandButton,
each time the button is clicked a new instance of w_employee
is created. In other words, a new window is opened each time the
button is clicked.

So by creating variables whose data type is the name of a
window, you can open multiple instances of a window. This is easy
and straightforward. PowerBuilder manages the windows for you–for
example, freeing memory when you close the windows.

Closing an instance

A common way to close the instances of a window is to put
a CommandButton in the window with this script for the Clicked event:

This script closes the parent of the button (the window in
which the button displays). Continuing the example above, if you
put a CommandButton in w_employee, the script closes the
current instance of w_employee. If you click the CommandButton
in the mywin instance of w_employee, mywin closes.


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