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

Creating an HTML page – PB Docs 110 – PowerBuilder Library

Creating an HTML page – PB Docs 110

Creating an HTML page

After creating and building the PowerBuilder PBDs for your
PowerBuilder window ActiveX application, you need to create the
HTML page that displays it.

To include a PowerBuilder window on a Web page, you use the
Object element. Element attributes specify the class ID for the
PowerBuilder window ActiveX, the space allocated for the window,
the name of the PBD, the name of the child window in the PBD, the
library list, and the version of PowerBuilder.

A sample Object element might be:

Attributes of the Object element

The Object element is part of the HTML specification for ActiveX
controls. It defines several standard attributes, and PowerBuilder
defines additional attributes.

HTML attributes

HTML attributes specify the class ID, the name, and the space
reserved for the PowerBuilder window ActiveX on the Web page.

Table 34-2: HTML attributes of Object element
HTML attribute Value
NAME Name of the object when referenced in
code or when submitted as part of a form.
CLASSID The class ID of the registered ActiveX
control.

The syntax is:

To find the class ID value of the registered ActiveX control, you
can use the PowerBuilder Browser’s OLE tab. Expand the
OLE Custom Controls item, then expand the PowerBuilder Window Control
or Secure Window Control item. The class ID is the value of the
GUID item of the Class Information branch.

CODEBASE A URL identifying the location of the
OCX or CAB file to be downloaded if the client machine does not
contain the PowerBuilder window ActiveX.

The client machine must still have the PowerBuilder virtual machine
and any other required DLLs on the system path.

WIDTH The width of the viewing window in pixels.
HEIGHT The height of the viewing window in pixels.

The WIDTH and HEIGHT attributes define the maximum width and
height of the child window. If the child window is resizable, the
user can make it smaller than the specified size, but not larger.

Param elements

To specify properties for the PowerBuilder window ActiveX,
include Param elements. Param elements let you identify the window
object that starts your application, the Application object, additional
libraries, and additional parameters to pass to the PowerBuilder
window ActiveX. Table 34-3 lists
the PowerBuilder-specific Param elements.

Table 34-3: PowerBuilder window ActiveX Param
elements
Property Value
PBWINDOW The class name of the child window in
the PBD.
LIBLIST A list of PowerBuilder dynamic libraries
(PBD files) required by the application. Separate multiple entries with
a semicolon.
PBAPPLICATION
(optional)
The PowerBuilder Application object.
PBVERSION The version of the PowerBuilder DLLs
(for example, 110).
DISPLAYERRORS
(optional)
Boolean indicating whether to display
execution errors.
COMMANDPARM
(optional)
A string you want to pass to your window.
To access this string from within your window, call the CommandParm function.

note.gif Coding the Object element To minimize coding errors, use an ActiveX-aware HTML editor
(such as the JSP targets HTML editor, the ActiveX Control Pad, or
Front Page) when coding an Object element and its parameters.

Basic page

This sample page includes the PowerBuilder window ActiveX:

intrx010.gif

Here is the HTML code that produces this page (note the use
of the Object element to specify the PowerBuilder window ActiveX):

Client-side scripting

You can interact with the window displayed in a PowerBuilder
window ActiveX by adding JavaScript or VBScript to the HTML page.
You can:

  • Code event handlers that respond
    to events that occur in the window
  • Call PowerScript functions to obtain pointer information,
    print, set redraw, or set a timer
  • Call the InvokePBFunction function
    to invoke a user-defined window function
  • Call the TriggerPBEvent function
    to trigger a user event on the window

note.gif Viewing ActiveX properties, events, and functions When the window ActiveX is registered on your
machine, you can use the PowerBuilder Browser’s OLE tab
to see the list of window ActiveX properties, events, and functions.

Coding event handlers

Your HTML page can contain JavaScript or VBScript event handlers
for the PowerBuilder window ActiveX.

note.gif Coding example assumptions The following code examples assume that the HTML page includes
a Form, named buttonForm, which contains several Input elements:
passedFlags, passedXPos, and passedYPos.

proc.gif To code JavaScript event handlers for the PowerBuilder
window ActiveX:

  1. Insert the PowerBuilder window ActiveX
    into the HTML page, specifying all necessary properties:

  2. Within the heading of the HTML page, code a function
    to be called when the event occurs.

    The following sample function simply displays the arguments
    to the Clicked event.

  3. Within the body of the HTML page, code an event
    handler that calls the function when the event occurs:

    note.gif Coding style Alternatively, you can omit the function call, placing all
    code within the event handler, as shown next.

proc.gif To code VBScript event handlers for the PowerBuilder
window ActiveX:

  1. Insert the PowerBuilder window ActiveX
    into the HTML page, specifying all necessary properties:

  2. Within the body of the HTML page, code an event
    handler that processes the event.

    This sample function simply displays the arguments to the
    Clicked event:

Calling PowerScript functions

The PowerBuilder window ActiveX allows you to call certain
PowerScript functions on the window displayed in the Active control:

  • PointerX Returns the distance from the left edge of the window to the pointer.
  • PointerY Returns the distance from the top of the window to the pointer.
  • Print Prints the window.
  • SetRedraw Turns on or off automatic redrawing of the window after every
    change.
  • Timer Causes the window’s Timer event to occur repeatedly
    at the specified interval.

For more information on these functions, see
the PowerScript Reference.

As with all ActiveX controls, the PowerBuilder window ActiveX
provides an AboutBox function, which you can
call to see information about the control.

note.gif Coding example assumptions The following coding examples assume that you have written
scripts to be invoked by the PowerBuilder window’s Timer
event.

proc.gif To use JavaScript to call a PowerScript function:

  1. Code a function to call the PowerScript
    function.

    This example calls the PowerScript Timer function:

  2. Code a function, anchor, or button that calls
    the function.

    This example uses a button on a form to call the function
    defined above, which resets the timer interval:

proc.gif To use VBScript to call a PowerScript function:

  1. Code a function to call the PowerScript
    function. This example calls the PowerScript Timer function:

  2. Code a function, anchor, or button that calls
    the function.

    This example uses a button on a form to call the function
    defined above, which resets the timer interval:

Calling user-defined functions

The PowerBuilder window ActiveX provides the InvokePBFunction function, which
you can use to call a user-defined window function.

note.gif VBScript and JavaScript differ If your user-defined functions contain arguments and you are
using JavaScript, you must use SetArgElement to specify the arguments;
you cannot specify the arguments explicitly in the InvokePBFunction function.

proc.gif To code JavaScript that invokes a user-defined
function:

  1. Define window functions as needed.

    The following example assumes that in the PowerBuilder window,
    you have defined the function of_arg that
    takes a string as a parameter.

  2. Code a JavaScript function that calls the InvokePBFunction function, specifying
    the user-defined function to invoke.

    This example initializes arguments and calls the of_args window
    function:

  3. Code a function, anchor, or form button that invokes
    your JavaScript function. For example:

note.gif Defining arguments in JavaScript When coding in JavaScript, define function and event arguments
by calling the SetArgElement function.

proc.gif To code VBScript that invokes a user-defined function:

  1. Define window functions as needed.

    The following example assumes that in the PowerBuilder window
    you have defined the function of_arg that
    takes a string as a parameter.

  2. Code a VBScript function that calls the InvokePBFunction function, specifying
    the user-defined function to invoke.

    This example initializes arguments and calls the of_args window
    function:

  3. Code a function, anchor, or form button whose
    click invokes your VBScript function. For example:

Calling user events

The PowerBuilder window ActiveX provides the TriggerPBEvent function, which
you can use to call a user event on the window.

proc.gif To code JavaScript that triggers a user event:

  1. Define user events on the window as needed.

    The following example assumes that in the PowerBuilder window
    you have defined the user event ue_args that takes a string
    as an argument.

  2. Code a function to call the user event. This example
    initializes arguments and calls the ue_args window event:

  3. Code a function, anchor, or form button that calls
    the TriggerPBEvent function. For example:

proc.gif To code VBScript that triggers a user event:

  1. Define user events on the window, as needed.

    The following example assumes that in the PowerBuilder window
    you have defined the user event ue_args that takes a string
    as an argument.

  2. Code a function to call the user event. This example
    initializes arguments and calls the ue_args window function:

  3. Code a function, anchor, or form button whose
    click invokes your VBScript function. For example:


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