About structures – PB Docs 2017

About
structures

General information

A structure is a collection of one or more variables (sometimes
called elements) that you want to group together under a single name. The
variables can have any datatype, including standard and object datatypes
and other structures.

Defining structures

When you define a structure in the Structure painter or an object
painter (such as Window, Menu, or User Object), you are creating a
structure definition. To use the structure, you must declare it. When you
declare it, an instance of it is automatically created for you. When it
goes out of scope, the structure is destroyed.

For details about defining structures, see the Working with Structures in Users Guide.

Declaring structures

If you have defined a global structure in the Structure painter
called str_emp_data, you can declare an instance of the structure in a
script or in an object’s instance variables. If you define the structure
in an object painter, you can only declare instances of the structure in
the object’s instance variables and scripts.

This declaration declares two instances of the structure
str_emp_data:

Referring to structure
variables

In scripts, you refer to the structure’s variables using dot
notation:

These statements assign values to the variables in
str_emp_data:

Using structures as instance
variables

If the structure is declared as part of an object, you can qualify
the structure name using dot notation:

Suppose that this declaration is an instance variable of the window
w_customer:

The following statement in a script for the object refers to a
variable of str_cust_data. The pronoun This is optional, because the
structure declaration is part of the object:

The following statement in a script for some other object qualifies
the structure with the window name:


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