Getting Started

Appeon PowerBuilder® 2019 R2


DOCUMENT ID: DC37772-01-1900-01

LAST REVISED: March 24, 2020

Copyright © 2019 Appeon. 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 Inc.

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

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 Inc., 1/F, Shell Industrial Building, 12 Lee Chung Street, Chai Wan District, Hong Kong.

Table of Contents

Welcome to PowerBuilder
Introduction to PowerBuilder
What PowerBuilder is
The PowerBuilder environment
PowerBuilder objects
About the PowerBuilder Tutorial
Learning to build a client/server application
How you will proceed
How long it will take
What you will learn
Setting up for the tutorial
Building a Client/Server Application
LESSON 1 Starting PowerBuilder
Create a new workspace
Create a target
Specify an icon for the application
Change the size of the main window
Run the application
LESSON 2 Customizing the PowerBuilder Environment
Manipulate the System Tree window
Open an object
Manipulate views
Add an extra Script view
Display view title bars
Float and dock views
Manipulate tabbed views
Save a view layout scheme
Reset the default view layout scheme
Set up the toolbars
Show labels on toolbar buttons
Float the toolbars
Reposition the toolbars
LESSON 3 Building a Login Window
Create a new window
Add controls to the window
Add a Picture control
Add StaticText controls
Specify properties of the StaticText controls
Add SingleLineEdit controls
Specify properties of the SingleLineEdit controls
Add CommandButton controls
Specify properties of the CommandButton controls
Change the tab order on the window
Code some Help events and preview the window
Write the script to open the window
Modify the frame window Open event
Compile the script
LESSON 4 Connecting to the Database
Look at the Demo Database
Look at the database profile for the Demo Database
Look at table definitions in the Demo Database
Run the Connection Object wizard
Declare a global variable
Modify the connection information
Modify the of_GetConnectionInfo function
Call the connection service manager
Complete the login and logout scripts
Set up shortcuts for AutoScript
Add code to the OK button Clicked event
Add code to the Cancel button Clicked event
Add code to the application Close event
Run the application
LESSON 5 Modifying the Ancestor Window
Add a library to the search path
Create a new ancestor sheet window
Create a new sheet window inheritance hierarchy
Add a DataWindow control for the master DataWindow
Add a DataWindow control for the detail DataWindow
View the scripts inherited from the user object
Add user events and event scripts
Add scripts to retrieve data for the DataWindow controls
Adjust a runtime setting for sheet window size
LESSON 6 Setting Up the Menus
Modify the frame menu
Modify the File menu
Enable Help menu items
Create a new sheet menu
Inherit and save a new menu
Add items to the new menu
Add a new toolbar for the new menu items
Add menu scripts to trigger user events
Attach the new menu and run the application
LESSON 7 Building DataWindow Objects
Create and preview a new DataWindow object
Save the DataWindow object
Make cosmetic changes to the first DataWindow object
Create a second DataWindow object
Select the data source and style
Select the table and columns
Define a retrieval argument
Specify a WHERE clause
View the DataWindow in the DataWindow painter
Save the DataWindow object
Make cosmetic changes to the second DataWindow object
Rearrange the columns and labels
Align the columns and labels
Display the arrow for a drop-down DataWindow edit style
LESSON 8 Attaching the DataWindow Objects
Attach the DataWindow object to the master DataWindow control
Attach the DataWindow object to the detail DataWindow control
Run the application
Attach DataWindow objects to the Product window
Run the application again
LESSON 9 Running the Debugger
Add breakpoints in application scripts
Run in debug mode
Set a watch and a conditional breakpoint
LESSON 10 Exception Handling
Add a new sheet window to the existing application
Create the sheet window
Provide access to the sheet window from the main application frame
Create user-defined exception objects
Create a new user function and user event
Call the methods and catch the exceptions
Run the application
Test the new sheet window
Add a test for the divide-by-zero error
LESSON 11 Preparing the Application for Deployment
Create the Project object
Create the executable file
Create a shortcut
Test the executable file
What to do next