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

User-Defined Enumerations – PB Docs 125 – PowerBuilder Library

User-Defined Enumerations – PB Docs 125


User-Defined Enumerations

To use enumerations that you import from a .NET assembly,
you must surround the enumeration references in a conditional compilation
block that is valid for your .NET target environment.

Declaring .NET enumerations in PowerScript

You must also
append an exclamation mark (�!�) to each of
the enumeration�s constant strings that you declare in
the conditional code block.

For example, the following code defines the .NET enumeration
class TimeOfDay:

In PowerScript, you reference a .NET enumeration constant
string as follows, when TimeOfDay is an enumeration class in the
ns_1.ns_2 namespace:

Scope of enumeration constant

When you set a system-defined enumeration constant in standard PowerBuilder
applications, there is no issue regarding the scope of the constant definition,
since all system enumeration constants are uniquely defined. However,
for .NET enumerations, you must define a scope for the constant using
the syntax:

If the enumeration class is declared under a namespace, you
must include the namespace when you set an enumeration constant:

If there is no enumerationType enumeration
class prefacing the declaration of a constant in a .NET conditional
code block, PowerBuilder assumes the enumeration is a system-defined
type and returns an error if the system-defined type is
not found.

The syntax for a PowerBuilder system enumeration constant
in the .NET environment is:

Although you cannot use dot notation in a constant declaration
for a system-defined enumeration in standard PowerScript,
the pb2cs compiler must let you use dot notation
for constant declarations that you make in a conditional compilation
block for the .NET environment. Prefixing a constant declaration in
the .NET environment with a PowerBuilder system enumeration name
is equivalent to making the same declaration without a prefix.

The VM initially checks whether the enumerationType is
a declared .NET enumeration class. If it does not find the enumeration
class, it checks whether the enumerationType is
a PowerBuilder system enumeration. When the enumerationType matches
the name of a PowerBuilder system enumeration, the VM sets the constant
for your .NET application or component.

Therefore, for the system Alignment enumeration, the constant
declaration Alignment.Left! produces
the same result as the Left! declaration
inside a .NET conditional code block. Outside such a code block,
the Alignment.Left! declaration
causes a compiler error.


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