Application Techniques

Appeon PowerBuilder® 2017 R3

FOR WINDOWS

DOCUMENT ID: DC37774-01-1700-01

LAST REVISED: July 25, 2018

Copyright © 2018 by Appeon Limited. All rights reserved.

This publication pertains to Appeon software and to any subsequent release until otherwise indicated in new editions or technical notes. Information in this document is subject to change without notice. The software described herein is furnished under a license agreement, and it may be used or copied only in accordance with the terms of that agreement.

Upgrades are provided only at regularly scheduled software release dates. No part of this publication may be reproduced, transmitted, or translated in any form or by any means, electronic, mechanical, manual, optical, or otherwise, without the prior written permission of Appeon Limited.

Appeon and other Appeon products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Appeon Limited.

SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP and SAP affiliate company.   

Java and all Java-based marks are trademarks or registered trademarks of Oracle and/or its affiliates in the U.S. and other countries.

Unicode and the Unicode Logo are registered trademarks of Unicode, Inc.

All other company and product names mentioned may be trademarks of the respective companies with which they are associated.

Use, duplication, or disclosure by the government is subject to the restrictions set forth in subparagraph (c)(1)(ii) of DFARS 52.227-7013 for the DOD and as set forth in FAR 52.227-19(a)-(d) for civilian agencies.

Appeon Limited, 1/F, Shell Industrial Building, 12 Lee Chung Street, Chai Wan District, Hong Kong


Table of Contents

Sample Applications
Using Sample Applications
About the sample applications
Installing the sample applications
Opening the sample applications
Using the Code Examples application
Browsing the examples
Finding examples
Running and examining examples
Language Techniques
Selected Object-Oriented Programming Topics
Terminology review
PowerBuilder techniques
Other techniques
Selected PowerScript Topics
Dot notation
Constant declarations
Controlling access for instance variables
Resolving naming conflicts
Return values from ancestor scripts
Types of arguments for functions and events
Ancestor and descendant variables
Optimizing expressions for DataWindow and external objects
Exception handling in PowerBuilder
Basics of exception handling
Objects for exception handling support
Handling exceptions
Creating user-defined exception types
Adding flexibility and facilitating object reuse
Using the SystemError and Error events
Garbage collection and memory management
Configuring memory management
Efficient compiling and performance
Reading and writing text or binary files
Getting Information About PowerBuilder Class Definitions
Overview of class definition information
Terminology
Who uses PowerBuilder class definitions
Examining a class definition
Getting a class definition object
Getting detailed information about the class
Getting information about a class's scripts
Getting information about variables
User Interface Techniques
Building an MDI Application
About MDI
Building an MDI frame window
Using sheets
Providing MicroHelp
Using toolbars in MDI applications
Customizing toolbar behavior
Saving and restoring toolbar settings
Sizing the client area
About keyboard support in MDI applications
Managing Window Instances
About window instances
Declaring instances of windows
Using window arrays
Referencing entities in descendants
Using Tab Controls in a Window
About Tab controls
Defining and managing tab pages
Customizing the Tab control
Using Tab controls in scripts
Referring to tab pages in scripts
Referring to controls on tab pages
Opening, closing, and hiding tab pages
Keeping track of tab pages
Creating tab pages only when needed
Events for the parts of the Tab control
Using TreeView Controls
About TreeView controls
Populating TreeViews
Functions for inserting items
Inserting items at the root level
Inserting items below the root level
Managing TreeView items
Deleting items
Renaming items
Moving items using drag and drop
Sorting items
Managing TreeView pictures
Pictures for items
Setting up picture lists
Using overlay pictures
Using DataWindow information to populate a TreeView
Using Lists in a Window
About presenting lists
Using lists
Using drop-down lists
Using ListView controls
Using report view
Using Drag and Drop in a Window
About drag and drop
Drag-and-drop properties, events, and functions
Identifying the dragged control
Providing Online Help for an Application
Creating help files
Providing online help for developers
Providing online help for users
Data Access Techniques
Using Transaction Objects
About Transaction objects
Description of Transaction object properties
Transaction object properties and supported PowerBuilder database interfaces
Working with Transaction objects
Transaction basics
The default Transaction object
Assigning values to the Transaction object
Reading values from an external file
Connecting to the database
Using the Preview tab to connect in a PowerBuilder application
Disconnecting from the database
Defining Transaction objects for multiple database connections
Error handling after a SQL statement
Pooling database transactions
Using Transaction objects to call stored procedures
Step 1: define the standard class user object
Step 2: declare the stored procedure as an external function
Step 3: save the user object
Step 4: specify the default global variable type for SQLCA
Step 5: code your application to use the user object
Supported DBMS features when calling stored procedures
Using MobiLink Synchronization
About MobiLink synchronization
How the synchronization works
Working with PowerBuilder synchronization objects
Preparing to use the wizard
What gets generated
Creating an instance of MLSync
Auxiliary objects for MobiLink synchronization
Using the synchronization objects in your application
Runtime requirements for synchronization on remote machines
Preparing consolidated databases
Connection events
Table events
Working with scripts and users in SQL Central
Creating remote databases
Creating and modifying publications
Creating MobiLink users
Adding subscriptions
Synchronization techniques
Using PowerBuilder XML Services
About XML and PowerBuilder
About PBDOM
PBDOM object hierarchy
PBDOM node objects
PBDOM_OBJECT
PBDOM_DOCUMENT
PBDOM_DOCTYPE
PBDOM_ELEMENT
PBDOM_ATTRIBUTE
PBDOM_ENTITYREFERENCE
PBDOM_CHARACTERDATA
PBDOM_TEXT
PBDOM_CDATA
PBDOM_COMMENT
PBDOM_PROCESSINGINSTRUCTION
Adding pbdom170.pbx to your application
Using PBDOM
Validating the XML
Creating an XML document from XML
Creating an XML document from scratch
Accessing node data
Manipulating the node-tree hierarchy
Handling PBDOM exceptions
XML namespaces
Setting the name and namespace of a PBDOM_ATTRIBUTE
Manipulating Graphs
Using graphs
Working with graph controls in code
Populating a graph with data
Modifying graph properties
How parts of a graph are represented
Referencing parts of a graph
Accessing data properties
Getting information about the data
Saving graph data
Modifying colors, fill patterns, and other data
Using point and click
Implementing Rich Text
Using rich text in an application
Sources of rich text
Language of rich text
Selecting a rich text editor
Deploying a rich text application
Using a RichText DataWindow object
Using a RichTextEdit control
Giving the user control
Text for the control
Using an ActiveX spell checking control
Formatting of rich text
Input fields
Using database data
Cursor position in the RichTextEdit control
Preview and printing
Rich text and the end user
Piping Data Between Data Sources
About data pipelines
Building the objects you need
Building a Pipeline object
Building a supporting user object
Building a window
Performing some initial housekeeping
Starting the pipeline
Monitoring pipeline progress
Canceling pipeline execution
Committing updates to the database
Handling row errors
Repairing error rows
Abandoning error rows
Performing some final housekeeping
Using RESTFul Web Services with JSON
Examples
Example 1 (using RESTClient)
Example 2 (using JSONPackage, HTTPClient, & ImportJson)
Example 3 (using HTTPClient & JSONParser)
Supporting OAuth 2.0 Authorization Server
Examples
Resource Owner Password
Client Credentials Grant
Extension Grant
Program Access Techniques
Using DDE in an Application
About DDE
DDE functions and events
Using OLE in an Application
OLE support in PowerBuilder
OLE controls in a window
OLE controls and insertable objects
Setting up the OLE control
Linking versus embedding
Offsite or in-place activation
Menus for in-place activation
Modifying an object in an OLE control
OLE custom controls
Setting up the custom control
Programming the ActiveX control
Programmable OLE Objects
OLEObject object type
Assignments among OLEControl, OLECustomControl, and OLEObject datatypes
Automation scenario
OLE objects in scripts
The automation interface
Automation and the Any datatype
OLEObjects for efficiency
Handling errors
Creating hot links
Setting the language for OLE objects and controls
Low-level access to the OLE object
OLE objects in DataWindow objects
OLE information in the Browser
Advanced ways to manipulate OLE objects
Structure of an OLE storage
Object types for storages and streams
Opening and saving storages
Opening streams
Strategies for using storages
Building a Mail-Enabled Application
About MAPI
Using MAPI
Using External Functions and Other Processing Extensions
Using external functions
Declaring external functions
Sample declarations
Passing arguments
Using utility functions to manage information
Sending Windows messages
The Message object
Message object properties
Context information
Context information service
Context keyword service
CORBACurrent service (obsolete)
Error logging service
Internet service
Transaction server service
Developing Distributed Applications
Distributed Application Development with PowerBuilder
Distributed application architecture
Server support
Building a COM or COM+ Client
About building a COM or COM+ client
Connecting to a COM server
Interacting with the COM component
Controlling transactions from a client
Building an EJB client (obsolete)
About building an EJB client
Adding pbejbclient170.pbx to your application
Generating EJB proxy objects
Using an EJB Proxy project
Using the ejb2pb170 tool
Viewing the generated proxies
Datatype mappings
Creating a Java VM
Connecting to the server
Invoking component methods
Exception handling
Client-managed transactions
Debugging the client
Developing Web Applications
Web Application Development with PowerBuilder
Building Web applications
.NET Web components
Web services (Deprecated)
Web DataWindow (obsolete)
DataWindow Web control for ActiveX (obsolete)
Building a Web Services Client (Deprecated)
About Web services
About building a Web services client
Choosing a Web service engine
Assigning firewall settings to access a Web service
Importing objects from an extension file
Generating Web service proxy objects
Connecting to a SOAP server
Invoking the Web service method
Using .NET Web services with custom headers
Using cookies with the Web service client
Exception handling
Using the UDDI Inquiry API
General Techniques
Internationalizing an Application
Developing international applications
Using Unicode
About Unicode
Unicode support in PowerBuilder
Internationalizing the user interface
Localizing the product
About the Translation Toolkit
Building Accessible Applications
Understanding accessibility challenges
Accessibility requirements for software and Web applications
Creating accessible software applications with PowerBuilder
About VPATs
Testing product accessibility
Printing from an Application
Printing functions
Printing basics
Printing a job
Using tabs
Stopping a print job
Advanced printing techniques
Managing Initialization Files and the Windows Registry
About preferences and default settings
Managing information in initialization files
Managing information in the Windows registry
Building InfoMaker Styles and Actions
About form styles
Naming the DataWindow controls in a form style
Building and using a form style
Modifying an existing style
Identifying the window as the basis of a style
Building a style from scratch
Completing the style
Working with the central DataWindow controls
Adding controls
Defining actions
Using menus
Writing scripts
Adding other capabilities
Using the style
Building a form with the custom form style
Managing the use of form styles
Deployment Techniques
Packaging an Application for Deployment
About deploying applications
Creating an executable version of your application
Compiler basics
Learning what can go in the package
Creating a PowerBuilder resource file
Choosing a packaging model
Implementing your packaging model
Testing the executable application
Delivering your application to end users
Installation checklist
Starting the deployed application
Deploying Applications and Components
Deploying applications, components, and supporting files
PowerBuilder Runtime Packager
Third-party components and deployment
Apache files
Microsoft files
Oracle files
Software used for SOAP clients for Web services (Deprecated)
PowerBuilder runtime files
Database connections
Native database drivers
ODBC database drivers and supporting files
OLE DB database providers
ADO.NET database interface
JDBC database interface
Java support
PowerBuilder extensions
PDF and XSL-FO export
Using the Ghostscript distiller
Using the PDFlib generator
Using the Apache FO processor
Deploying 64-Bit Windows Applications
Deploying 64-Bit Windows Applications