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

Open – PB Docs 150 – PowerBuilder Library

Open – PB Docs 150

Open event

The Open event has different arguments for different
objects:

Object

See

Application

Syntax 1

Window

Syntax 2

Syntax 1 For the application object

Description

Occurs when the user starts the application.

Event ID

Event ID

Objects

None

Application

Parameters

Argument

Description

commandline

String by value.
Additional arguments are included on the command line after the
name of the executable program.

Return Values

None (do not use a RETURN statement)

Usage

This event can establish database connection parameters and
open the main window of the application.

note.png On Windows

You can specify command line arguments when you use the Run
command from the Start menu or as part of the Target specification
when you define a shortcut for your application.

There is no way to specify command line values when you are
testing your application in the development environment.

In other events and functions, you can call the CommandParm function
to get the command line arguments.

For an example of parsing the string in commandline,
see CommandParm.

Examples

This example populates the SQLCA global variable
from the application’s initialization file, connects to
the database, and opens the main window:

See Also

Syntax 2 For windows

Description

Occurs when a window is opened by one of the Open functions.
The event occurs after the window has been opened but before it
is displayed.

Event ID

Event ID

Objects

pbm_open

Window

Parameters

None

Return Values

Long. Return code choices (specify in
a RETURN statement):

  • 0 Continue
    processing

Usage

These functions trigger the Open event:

  • Open

  • OpenWithParm

  • OpenSheet

  • OpenSheetWithParm

When the Open event occurs, the controls on the window already
exist (their Constructor events have occurred). In the Open event
script, you can refer to objects in the window and affect their
appearance or content. For example, you can disable a button or
retrieve data for a DataWindow.

Some actions are not appropriate in the Open event, even though
all the controls exist. For example, calling the SetRedraw function
for a control fails because the window is not yet visible.

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:

note.png Changing the WindowState property

Do not change the WindowState property in the Open event of
a window opened as a sheet. Doing so might result in duplicate controls
on the title bar. You can change the property in other scripts once
the window is open.

When a window is opened, other events occur, such as Constructor
for each control in the window, Activate and Show for the window,
and GetFocus for the first control in the window’s tab
order.

When a sheet is opened in an MDI frame, other events occur,
such as Show and Activate for the sheet and Activate for the frame.

Examples

When the window contains a DataWindow control, you
can retrieve data for it in the Open event. In this example, values
for the transaction object SQLCA have already been set up:

See Also


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