Invoking component methods – PB Docs 70

Invoking component methods

Once a connection to a Jaguar server has been established
and a proxy object created, the client application can begin using
the server components.

How to invoke a method

To invoke a component method, you need to execute the PowerScript statements
required to perform these operations:

  1. Use the CreateInstance
    method to create an instance of the component.
  2. Invoke the method.

Example 1 This script instantiates a component on the server and invokes
a component method. In this example, the CreateInstance method does
not specify a package; therefore, Jaguar uses the default package
specified in the Application property of the Connection object:

Example 2 This script instantiates a component on the server and assigns
the object reference to a variable whose data type is an ancestor
of the class for the component. The second argument to the CreateInstance
function specifies the class name for the component as well as the
Jaguar package name:

Destroying the proxy object instance

After you’ve finished using a Jaguar component, you
can explicitly destroy the Jaguar proxy object by using the DESTROY
statement, or you can let PowerBuilder’s garbage collection
facility clear the object out of memory for you automatically. In
either case, the destruction of the client-side proxy object has
no effect on the lifecycle of the server component. Destruction
of the server component is handled by Jaguar.

If the Automatic Demarcation/Deactivation setting
is disabled for a component, and you close the client application
while the component is still bound to the client (the component
did not call SetComplete or SetAbort), the component will not
be
deactivated. To ensure that the component instance is deactivated,
you can do one of the following things:

  • In
    the Close event of the client application, invoke a method of the
    server component that deactivates the component (by calling SetComplete
    or SetAbort).
  • Set the Timeout property for the component to a
    value other than 0. If the component’s Timeout property
    is set to 0, the component will never time out.

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