Working with PowerBuilder

About this chapter

This chapter describes the basics of working in the PowerBuilder development environment.

Before you begin

If you are new to PowerBuilder, doing the tutorial in Getting Started will help you become familiar with the development environment. The tutorial guides you through the process of building a PowerBuilder application.

About PowerBuilder

PowerBuilder is an object-centric graphical application development environment. Using PowerBuilder, you can easily develop many types of applications and components. PowerBuilder provides all the tools you need to build enterprise systems, such as order entry, accounting, and manufacturing systems.

Two-tier applications

PowerBuilder applications can be traditional graphical client/server two-tier applications that access server databases. A traditional client/server application is a collection of windows that contain controls that users can interact with. You can use standard controls such as buttons, check boxes, drop-down lists, and edit controls as well as special PowerBuilder controls that make your applications easy to develop and easy to use.

Multitier applications

You can also build multitier applications with PowerBuilder. A multitier application usually has a client application that requests services from a server application or component. For example, your client application could request services from a PowerBuilder component on an application server. The server component often requests services from a server database and/or other server components.

Web applications

PowerBuilder applications can also be Web based. You can create a new Web-based application for the Internet or Intranet, or adapt or extend an existing PowerBuilder application for the Web.

Concepts and terms

This section discusses some basic concepts and terms you need to be familiar with before you start using PowerBuilder to develop applications and components.

Workspaces and targets

In PowerBuilder, you work with one or more targets in a workspace. You can add as many targets to the workspace as you want, open and edit objects in multiple targets, and build and deploy multiple targets at once.

A PowerBuilder target can be one of several types:

  • Application target

    A client/server or multitier executable application. Most of this book is concerned with building application targets. See Working with Targets.

  • .NET target (obsolete)

    .NET assembly and .NET Web service is considered to be obsolete. The ability to use this technique has been retained for backward compatibility.

    You may consider using the the section called “HTTPClient object” object as a replacement.

All of these targets can use PowerBuilder's built-in language, PowerScript.

You choose targets in the New dialog box. Here are the Target types that are available in PowerBuilder:


For more information about creating a workspace and targets, see Creating and opening workspaces and Creating a target.

Objects

Your application is a collection of objects.For most targets, PowerBuilder provides many types of objects, including graphical objects such as windows, menus, and buttons, and nonvisual objects such as datastore, exception, and timing objects.

As you work in your application, you create new objects and open existing objects to continue work on their development.

For more information about creating, opening, and editing objects, see Working with objects.

DataWindow objects

The applications you build are often centered around your organization's data. With PowerBuilder you can define DataWindow objects to retrieve, display, and manipulate data. For more information about DataWindow objects, see Defining DataWindow Objects.

PowerBuilder libraries

As you work in an application, component, or .NET target, the objects you create are stored in one or more libraries (PBL files) associated with the application. When you run your application, PowerBuilder retrieves the objects from the library.

PowerBuilder provides a Library painter for managing your libraries. For information about creating a new library and working with libraries in the Library painter, see Working with Libraries.

Painters and editors

Some of the editors you use to edit objects are called painters. For example, you build a window in the Window painter. There you define the properties of the window, add controls such as buttons and labels, and code the window and its controls to work as your application requires.

PowerBuilder provides painters for windows, menus, DataWindow objects, visual and nonvisual user-defined objects, functions, structures, databases, data pipelines, and the application itself. For each of these object types, there is also a Source editor in which you can modify code directly. See Working in painters and Using the Source editor.

There is also a file editor you can use to edit any file without leaving the development environment. See Using the file editor.

Events and scripts

Applications are event-driven: users control the flow of the application by the actions they take. When a user clicks a button, chooses an item from a menu, or enters data into a text box, an event is triggered. You write scripts that specify the processing that should happen when the event is triggered.

For example, buttons have a Clicked event. You write a script for a button's Clicked event that specifies what happens when the user clicks the button. Similarly, edit controls have a Modified event that is triggered each time the user changes a value in the control.

You write scripts using PowerScript, the PowerBuilder language, in a Script view in the painter for the object you are working on. Scripts consist of PowerScript functions, expressions, and statements that perform processing in response to an event. The script for a button's Clicked event might retrieve and display information from the database; the script for an edit control's Modified event might evaluate the data and perform processing based on the data.

Scripts can also trigger events. For example, the script for a button's Clicked event might open another window, which triggers the Open event in that window.

Functions

PowerScript provides a rich assortment of built-in functions you use to act upon the objects and controls in your application. There are functions to open a window, close a window, enable a button, retrieve data, update a database, and so on.

You can also build your own functions to define processing unique to your application.

Properties

All the objects and controls in an application or component have properties, many of which you set as you develop your application. For example, you specify a label for a button by setting its text property. You can set these properties in painters or set them and modify them dynamically in scripts.

Source control

If you are working with other developers on a large application, you can make sure you are working with the latest version of a component or object by synchronizing the copy of the object you are working on with the last version of the object checked into a source control system. PowerBuilder provides native interface options of SVN and Git for directly performing source control operations and functions in the PowerBuilder IDE. For more information, see Using Source Control.

PowerBuilder extensions

You can use PowerBuilder extension objects in an application in the same way as you would built-in PowerBuilder objects, with one difference -- you must import the file that contains the definition of the extension into a library in the target. Some extensions are provided with PowerBuilder, but you can also obtain them from third parties or build your own.

For more information about the extensions provided with PowerBuilder, see PowerBuilder Extension Reference. For how to build your own extensions, see PowerBuilder Native Interface Programmers Guide and Reference.

The PowerBuilder environment

When you start PowerBuilder for the first time, the Welcome to PowerBuilder dialog box lets you create a new workspace with or without targets:


When PowerBuilder starts, it opens in a window that contains a menu bar and the PowerBar at the top and the System Tree and Clip window on the left. The remaining area will display the painters and editors you open when you start working with objects.


The System Tree

The System Tree provides an active resource of programming information you use while developing targets. It lets you not only get information, but also drag objects into painter views (such as the Script view or Layout view) for immediate use.

The System Tree displays by default when you start PowerBuilder for the first time. You can hide or display the System Tree using the System Tree button on the PowerBar or by selecting Window>System Tree.

Using the Workspace tab page

The System Tree has a single tab page that provides a view of the current workspace. The Workspace tab page displays the current workspace and all its targets. Most targets display the library list for the target and all the objects in each PBL. The Workspace tab page in the System Tree works like a tree view in the Library painter, but you can keep it open all the time to serve as the control center of the development environment.

You can set the root of the Workspace page to your computer's root directory, the current selection, or any directory or library, as well as to the current workspace.

Working with targets

To see the pop-up menu that lets you perform operations on a target such as search, build, and migrate, you must set the root of the System Tree to the current workspace.

The following illustration shows a workspace with two targets.


Current target

The orders target is bold, indicating it is the current target, which means that it is the default target used in the New dialog box and for Run and Debug. The current target is set whenever you:

  • Invoke an action in the System Tree, Library painter, or main menu that affects a target or a child of a target, such as Build, Migrate, Run, or Debug. Some actions, such as Search and Migrate, display a dialog box. If you cancel the action by clicking the Cancel button in the dialog box, the current target is not changed.

  • Open an object painter.

  • Change the active object painter.

If you prefer to set the current target explicitly using the Set as Current Target pop-up menu item for the target in the System Tree or the File>Set Current Target menu item, clear the Automatically Set Current Target check box on the Workspaces tab page in the System Options dialog box. To open the System Options dialog box, select Tools>System Options from the main menu.

Actions in the System Tree

You can use the Workspace page as the hub of your PowerBuilder session. Pop-up menus let you build and deploy targets and open and edit any object. Double-clicking an event or function in the System Tree opens its script in the Script view. Events with scripts have a different icon and are listed before events without scripts.

The following table lists the actions you can take on each item that displays on the Workspace page. You can also set properties for each item, choose which object types display in the tree view, change the root of the Workspace page, and reset the root to the current workspace.

Item

Menu action items

Workspace

New (opens New dialog box), Add Target, Open Workspace, Close, Incremental Build, Full Build, Deploy, Run, Debug, Add to Source Control, Show, Open Containing Folder, Properties.

Target

New, Search, Set as Current Target, Remove Target, Library List, Migrate, Incremental Build, Full Build, Deploy, Run, Debug, Show, Open Containing Folder, Properties.

PBL

Search, Delete, Remove Library, Import, Import PB Extension, Optimize, Build Runtime Library, Print Directory, Show, Open Containing Folder, Properties.

PBD

Search, Delete, Remove Library, Print Directory, Show, Open Containing Folder, Properties

PowerBuilder object

Edit, Edit Source, Search, Inherit from, Run/Preview, Copy, Move, Delete, Regenerate, Export, Print, Properties.

Edit Source is not available for project and proxy objects. Inherit from and Run/Preview are available only for some object types. Source control items are available only if source control information is associated with the target.

Functions and events

Edit, Properties.

The Properties dialog box shows the prototype of the function or event and its "signature." The signature is a string that represents the argument types, return types, and passing style. You use this string when you write a PBNI extension that calls the function or event. For more information, see PowerBuilder Native Interface Programmers Guide and Reference.


The PowerBar

Like the System Tree, the PowerBar provides a main control point for building PowerBuilder applications and deploying the application as the native client/server app. From the PowerBar1 you can create new objects and applications, open existing objects, and debug and run the current application.

PainterBar1 provides buttons for creating, building and deploying the PowerClient or PowerServer projects. PainterBar1 is provided only in the CloudPro or Professional edition of PowerBuilder 2019 R3 or later.

PainterBar1 for a PowerClient project (available in the CloudPro or Professional edition of PowerBuilder 2019 R3 or later):


PainterBar1 for a PowerServer project (available in the CloudPro edition of PowerBuilder 2021 or later):


While you are getting used to using PowerBuilder, you can display a label on each button in a toolbar to remind you of its purpose. To do so, right-click any toolbar button and select Show Text from the pop-up menu.

The following table lists the buttons from left to right on the PowerBar1.


PowerBar1 button

What you can use it for

New

Create new objects.

Inherit

Create new windows, user objects, and menus by inheriting from an existing object.

Open

Open existing objects.

Run/Preview

Run windows or preview DataWindows.

System Tree

Work in the System Tree window, which can serve as the hub of your development session. For more information see The System Tree.

Output Window

Examine the output of a variety of operations (migration, builds, deployment, project execution, object saves, and searches). See The Output window.

Next Error, Previous Error

Navigate through the Output window.

To-Do List

Keep track of development tasks you need to do for the current application and use links to get you quickly to the place where you complete the tasks.

Browser

View information about system objects and objects in your application, such as their properties, events, functions, and global variables, and copy, export, or print the information.

Clip Window

Store objects or code you use frequently. You can drag or copy items to the Clip window to be saved and then drag or copy these items to the appropriate painter view when you want to use them. See The Clip window.

Library

Manage your libraries using the Library painter.

DB Profile

Define and use named sets of parameters to connect to a particular database.

Database

Maintain databases and database tables, control user access to databases, and manipulate data in databases using the Database painter.

Edit

Edit text files (such as source, resource, and initialization files) in the file editor.

Incremental Build Workspace

Update all the targets and objects in the workspace that have changed since the last build.

Full Build Workspace

Update all the targets and objects in the workspace.

Deploy Workspace

Deploy all the targets in the workspace.

Skip, Stop

Interrupt a build, deploy, or search operation. When a series of operations is in progress, such as a full deploy of the workspace, the Skip button lets you jump to the next operation. The Stop button cancels all operations.

Debug

Debug the current target. You can set breakpoints and watch expressions, step through your code, examine and change variables during execution, and view the call stack and objects in memory.

Select & Debug

Select a target and open the Debugger.

Run

Run the current target just as your users would run it. For standard PowerBuilder application targets, the application runs in the development environment.

For .NET targets, you must deploy the target before you can run it for the first time. If you have made changes since you last deployed, you must redeploy to see those changes when you click the Run button.

Select & Run

Select a target and run it.

Exit

Close PowerBuilder.


Customizing the PowerBar

You can customize the PowerBar. For example, you can choose whether to move the PowerBar around, add buttons for operations you perform frequently, and display text in the buttons.

For more information, see Using toolbars.

About PowerTips

In the PowerBar, when you leave the mouse pointer over a button for a second or two, PowerBuilder displays a brief description of the button, called a PowerTip.PowerTips display in PowerBuilder wherever there are toolbar buttons.

The Clip window

You can store code fragments you use frequently in the Clip window. You copy text to the Clip window to save it and then drag or copy this text to the appropriate Script view or editor when you want to use it.

Using the Clip window

The Clip window displays a list of named clips, a preview of the information contained in the clip, and a description. It provides buttons to move Clip window contents to the clipboard, copy clipboard contents to the Clip window, rename a clip, delete a clip, and modify the clip's description. Clips you save in one workspace are available in all your workspaces; you might want to use a naming convention that reflects this.

For example, you might use standard error-checking code when you use the ConnectToServer function to connect to a server. To copy it to the clipboard, highlight the code in a Script view and select Copy from the pop-up menu. In the Clip window, click the Paste icon, and name the clip. The Clip Description dialog box opens so that you can enter a description. To change the description later, select the clip's name and click the Modify button.

You can drag the clip from the Clip window to any script in which you want to connect to a server. You can also use the Copy icon to copy the clip to the clipboard.

You can hide or display the Clip window using the Clip Window button on the PowerBar or by selecting Window>Clip.


The Output window

The output of a variety of operations (migration, builds, deployment, project execution, object saves, and searches) displays in the Output window.

When you start a new PowerBuilder session, the Output window has a single tab, Default. New tabs are added as you perform operations.

Tab

Contents

Default

General information about the progress of full or incremental builds and project deployment

Debug

Debugger output, including the paths of assemblies loaded to support .NET debugging

Errors

Messages that indicate problems that prevent the build or deploy process from completing successfully

Warnings

Warning and informational messages

Search

Output from search operations

Unsupported features

For .NET targets, names and locations of features are not supported in the target type


Using the Output window

You can hide or display the Output window with the Output button on the PowerBar or by selecting Window>Output.

You control operations in the window using the Skip, Stop, Next Error, and Previous Error buttons or menu options.

Tabs display in the order in which they are created and remain in the Output window for the rest of the PowerBuilder session. To clear the output from the tabs automatically when you start a new build, make sure that the Automatically Clear Output Window check box on the General page of the System Options dialog box is selected. You can also clear and close tabs manually from the pop-up menu.

When appropriate, lines in the Output window provide links that invoke the correct painter when you double-click on that line. The pop-up menu also provides the options Edit and Edit Source to open an object in a painter or the Source editor. You can copy the contents of the current tab to the Windows clipboard, save its contents to a text file, or print its contents to your default printer.


Creating and opening workspaces

Before you can begin any development in PowerBuilder, you need to create or open a workspace.

Creating a workspace

To create a new workspace

  1. Do one of the following:

    • Click the New button in the PowerBar.

    • Select File>New from the menu bar.

    • In the Workspace tab of the System Tree, right-click the workspace name and select New from the pop-up menu.

    The New dialog box opens.

  2. On the Workspace tab, select Workspace.

    The New Workspace dialog box displays.

  3. Enter a name for the workspace (.pbw) you want to create and click Save.

    The workspace is created and the name of the new workspace displays in the PowerBuilder title bar.

Opening a workspace

The next time you start PowerBuilder, it opens without opening a workspace. You can change this behavior by modifying options on the Workspaces page of the System Options dialog box or on the Welcome to PowerBuilder screen. For example, you can have PowerBuilder open not only the workspace you used most recently, but also the objects and scripts you worked on last. See Starting PowerBuilder with an open workspace.

When PowerBuilder opens with an open workspace, it displays the name of the current workspace in the title bar. The current workspace is also displayed in the Workspace tab page in the System Tree. Although you can create multiple workspaces, you can have only one workspace open at a time. You can change workspaces at any time.

To change workspaces

  1. Do one of the following:

    • Select File>Open Workspace from the menu bar.

    • In the Workspace tab of the System Tree, right-click on the workspace name and select Open Workspace from the pop-up menu.

    The Open Workspace dialog box displays.

  2. From the list, select the workspace you want to open.

    The workspace is changed and the name of the new workspace displays in the PowerBuilder title bar.

To change the workspace to a recent workspace

  1. Select File>Recent Workspaces from the menu bar and select the workspace.

  2. The workspace list includes the eight most recently accessed workspaces. You can include up to 36 workspaces on the list by selecting Tools>System Options and modifying the number of items.

Using wizards

After you have created a workspace, you can add new or existing targets to it. The first step in building a new PowerBuilder target is to use a Target wizard to create the new target and name it.

About wizards

Wizards simplify the initial creation of applications and components. Using your specifications, wizards can create multiple objects and in some cases automatically generate complex code that you can modify as needed. The first page in most wizards explains what the wizard builds. If you need help with the information you need to give the wizard, click the Help [?] button in the upper right corner of the window and then click the field you need help with, or click the field and press F1.

You start wizards from the New dialog box, but not all the icons in the New dialog box represent wizards. On the Project tab page, there are two versions of some icons: one that starts a wizard, and one that takes you straight to the Project painter.

Many wizards generate To-Do List entries to guide you through the rest of the development of the application, object, or component. See Using the To-Do List.

Creating a target

When you create a target, you are prompted for the name and location of a Target (.pbt) file and one or more other objects. Target files are text files that contain information about the target.

To create a new target:

  1. Do one of the following:

    • Click the New button in the PowerBar.

    • Select File>New from the menu bar.

    • In the Workspace tab of the System Tree, highlight the workspace name and select New from the pop-up menu.

    The New dialog box opens.

  2. On the Target tab page, select one of the Target wizards.


    For more information about each type of Target wizard, see the sections following these instructions.

  3. Follow the instructions in the wizard, providing the information the wizard needs.

    In most wizards, you can review your choices on the summary page that displays when you have finished entering information. This is a summary page from the Template Application wizard:


    Be sure the Generate To-Do List check box is checked if you want the wizard to add items to the To-Do List to guide and facilitate your development work.

  4. When you are satisfied with your choices in the wizard, click Finish.

    The objects are created in the target you specified. If you specified that items were to be added to the To-Do List, you can see the items by clicking the To-Do List button in the PowerBar.

As you develop the application, you can use linked items on the To-Do list to open an object in the specific painter and view where you need to work. See Using the To-Do List.

Target types

This section describes each of the targets you can build.

Application targets

There are three wizards for creating application targets:

Application Target wizard

You use the Application Target wizard to create a new PowerScript-based Application object and the library containing it. You must create any other objects you need from scratch.

Template Application Target wizard

You use the Template Application Target wizard to create a PowerScript-based application, the library containing it, and a set of basic objects and scripts. If the application requires a connection to a SQL database, the wizard automatically creates a Connection object.

In the Template Application wizard, you can choose one of two application types: MDI Application and SDI Application.

MDI ApplicationThe wizard automatically generates the shell and scripts for a basic Multiple Document Interface (MDI) application that includes these objects:

  • Application object

  • Frame window

  • Frame menu

  • Base sheet window

  • Sheet menu

  • Sheet menu service object

  • Sheet windows

  • About window

  • Toolbar window

  • Connection service object (if database connection is needed)

  • Project object (optional; can build later using a Project wizard)

You can run the MDI application immediately by clicking the Run button on the PowerBar. You can open sheets, display an About box, and select items from menus. The To-Do List can help you use the application as a starting point for continuing development of an MDI application.

SDI ApplicationIn the Template Application wizard, you can also choose to create a Single Document Interface (SDI) application. An SDI application has only one main window with a menu and an about window. If the application requires a connection to a SQL database, the wizard automatically creates a Connection object.

For information about building MDI and SDI applications, see the section called “Building an MDI Application” in Application Techniques.

Existing Application Target wizard

You use the Existing Application Target wizard to add a target to your workspace that uses an application you built in an earlier version of PowerBuilder. After you complete the wizard, the Migrate Application dialog box opens so you can migrate the application to this version.

Before you upgrade. Always make a backup copy of all the PBLs used in an application before you upgrade it to a new version of PowerBuilder.

You can use the Migration Assistant to check for obsolete syntax in your application before you upgrade; then you can make changes in the earlier version of PowerBuilder and avoid some migration errors. The Migration Assistant is particularly useful if you are upgrading from PowerBuilder 6 or earlier. Open the Migration Assistant from the Tool tab of the New dialog box, and press F1 if you need help in the wizard.

You should also check the release notes for the version of PowerBuilder that you are using to find out if there are any migration issues that might affect you.

For more information about upgrading targets, see Upgrading targets.

For information about building standard PowerBuilder applications, see the rest of this book and Application Techniques.

C# targets

In the PowerBuilder CloudPro Edition and Professional Edition, if you have installed and activated PowerBuilder as well as SnapDevelop successfully, you can select the C# Projects target in the PowerBuilder IDE; which will launch SnapDevelop IDE for you to create a C# project.

For more information about these target wizards, refer to the SnapDevelop user guide.

.NET targets (Obsolete)

.NET Web Service target and .NET Assembly target are considered to be obsolete. The ability to use these techniques have been retained for backward compatibility.

The .NET Web service and .NET assembly components do not support PowerScript features added since version PowerBuilder 2017, including but not limited to CoderObject, CrypterObject, CompressorObject, ExtractorObject, DotNetAssembly, DotNetObject, HTTPClient, JSONGenerator, JSONPackage, JSONParser, OAuthClient, OAuthRequest, ResourceResponse, RESTClient, RibbonBar, TokenRequest, TokenResponse, WebBrowser etc.

You may consider using the the section called “HTTPClient object” object as a replacement for the .NET Web service and .NET assembly components.

Managing workspaces

This section describes how to add and remove targets, and to specify properties in a workspace.

Adding an existing target to a workspace

Although you can have only one workspace open at a time, you can add as many targets to the workspace as you want and open and edit objects in multiple targets.

Working with targets that share PBLs

If a target shares PBLs with another target in the same workspace, as is the case when you create a .NET target based on an existing application target, you should work on only one target at a time. Objects are always opened in the context of a specific target. When you open an object in a PBL that is used in multiple targets, PowerBuilder needs to set global properties for the specific target you are working on.

To add an existing target to a workspace

  1. Right-click on the workspace displayed in the System Tree and select Add Target from the pop-up menu.

    The Add Target to Workspace dialog box displays.

  2. Navigate to the directory containing the target you want to add and select the target (.pbt) file.

  3. Click Open.

    The target is added to your current workspace.

Removing a target from a workspace

When you remove a target from the workspace, the .pbt file is not deleted.

To remove a target from a workspace

  • Right-click on the target displayed in the System Tree and select Remove Target from the pop-up menu.

Specifying workspace properties

You specify workspace properties in the Properties of Workspace dialog box.

To specify workspace properties

  1. In the Workspace tab of the System Tree, select Properties from the pop-up menu for the workspace.

  2. Select the Targets, Deploy Preview, or Source Control tab page.

  3. Specify the properties as described in the following sections.

    Specifying target order. You can specify the targets and the order in which those targets are built or deployed on the Targets tab page. All the targets identified with the workspace are listed. Check the targets you want to include in the workspace build or deploy. Use the arrows to change a target's position in the target order list.

    Previewing deployment. You can verify the targets and the order in which those targets' projects are built or deployed on the Deploy Preview tab page. To make changes, you need to use the Targets page of the Workspace dialog box.

    Specifying source control properties. You can specify which source control system, if any, is used for this workspace, as well as other source control properties. For more information, see Using Source Control.

Building workspaces

You can build and deploy workspaces while you are working in PowerBuilder, and from a command line.

In the development environment

In the development environment, you can specify how you want the targets in your workspace to be built and deployed. Then you can build individual targets or all the targets in the workspace. The following table summarizes where you set up build and deploy options, and how you start builds.

To do this

Do this

Set deploy options for most targets

Select Properties from the pop-up menu for the target and select the Deploy tab. Check the box next to a project to build it when you select Deploy from the target's pop-up menu. Use the arrows to set the order in which projects are built.

Set options for each project in the target in the Project painter.

Set build and deploy options for the workspace

Select Properties from the pop-up menu for the workspace and select the order in which targets should be built. You can check which projects and deploy configurations are currently selected on the Deploy Preview page.

Build, migrate, or deploy a selected target

Select Incremental Build, Full Build, Migrate, or Deploy from the pop-up menu for the target. Deploy builds the projects in the target in the order listed on the Deploy page of the target's properties dialog box.

Build or deploy all the targets in the workspace

Select Incremental Build, Full Build, or Deploy from the pop-up menu for the workspace, from the Run menu, or from the PowerBar.


From a command line

When you deploy or build a workspace from a command line, PowerBuilder starts, completes the build, and exits as soon as the operation is completed. To retain a log file for the session, you can send the contents of the Output window to a file. The following table shows command-line options for building and deploying targets and workspaces.

Option

Description

/workspace workspacepath

Open the workspace workspacepath

/target targetpath

Open the target targetpath

/deploy

Deploy the workspace and exit

/fullbuild

Fully build the workspace and exit

/incrementalbuild

Incrementally build the workspace and exit

/output outputpath

Log the contents of the Output window to outputpath


As with other command-line options, you need only use the initial letter or letters of the option name as long as the option is uniquely identified. The deploy, fullbuild, and incrementalbuild options can be used only with the workspace option. You need to create projects and specify build and deploy options for the workspace in PowerBuilder before you start a build from the command line. Deploy builds the projects in the target in the order listed on the Deploy page of the target's properties dialog box.

Example

This example assumes that the location of the PowerBuilder executable file is in your system path. It opens the workspace called CDShop, builds and deploys the targets in the workspace according to your specifications in the workspace and target properties, records the content of the Output window in the file D:\tmp\cdshop.out, and exits PowerBuilder:

pb190 /w D:\CDShop\CDShop.pbw /d /out D:\tmp\cdshop.out

The output from all the tab pages in the Output window and from all the projects is included in the output file.

There are additional command-line options you can use to start PowerBuilder. See Using command line arguments.

Working with tools

PowerBuilder provides a variety of tools to help you with your development work. There are several ways to open tools:

  • Click a button in the PowerBar for the tool you want

  • Select the tool from the Tools menu

  • Open the New dialog box and select the tool you want on the Tool tab page

The following table lists the tools available in the PowerBar. Some of these tools are also listed on the Tools menu.

Tool

What you use the tool for

To-Do List

Keep track of development tasks you need to do for the current target and create links to get you quickly to the place where you need to complete the tasks. For information, see Using the To-Do List.

Browser

View information about system objects and objects in your target, such as properties, events, functions, and global variables, and copy, export, or print the information. For information, see Browsing the class hierarchy.

Library painter

Manage libraries, create a new library, build dynamic libraries, and use source control.

Database profiles

Define and use named sets of parameters to connect to a particular database. For information, see the section called “Using database profiles” in Connecting to Your Database.

Database painter

For information, see Managing the Database.

File Editor

Edit text files such as source, resource, and initialization files. For information, see Using the file editor.

Debugger

Set breakpoints and watch expressions, step through your application, examine and change variables during execution, and view the call stack and objects in memory. For information, see Debugging and Running Applications.


The following table lists the tools you can launch from the Tool tab page in the New dialog box. You can also launch the Library painter and File Editor from this dialog box.

Tool

What you use the tool for

Migration Assistant

Scans PowerBuilder libraries and highlights usage of obsolete functions and events. For information, see the section called “Upgrading targets”.

DataWindow Syntax

Helps construct the syntax required by Modify, Describe, and SyntaxFromSQL functions. For information, see the section called “Using DWSyntax” in DataWindow Programmers Guide.

Profiling Class View, Profiling Routine View, and Profiling Trace View

Use trace information to create a profile of your application. For information, see Tracing and Profiling Applications.


Using the To-Do List

The To-Do List displays a list of development tasks you need to do. You can create tasks for any target in the workspace or for the workspace itself. A drop-down list at the top of the To-Do List lets you choose which tasks to display. To open the To-Do List, click the To-Do List button in the PowerBar or select Tools>To-Do List from the menu bar.

To-Do List entries

The entries on the To-Do list are created:

  • Automatically by most PowerBuilder wizards to guide you through the continued development of objects of different types that you will need to build the application or component specified by the wizard

  • At any time by you when you are working in a painter and want a link to a task that you want to remember to complete

Some To-Do List entries created by wizards are hot-linked to get you quickly to the painter (and the specific object you need) or to a wizard. You can also create an entry yourself that links to the PowerBuilder painter where you are working so you can return to the object or script (event/function and line) you were working on when you made the entry. When you move the pointer over entries on the To-Do list, the pointer changes to a hand when it is over a linked entry.

For example, if you generate an MDI application with the Template Application wizard, one of the linked entries on the To-Do List reminds you to register new sheets with the sheet manager service, which is a nonvisual user object created by the wizard. Double-clicking this entry automatically opens the Window painter and the Script view where you register new sheets.


Exporting and importing lists

You can export or import a To-Do List by selecting Export or Import from the pop-up menu. Doing this is useful if you want to move from one computer to another or you need to work with To-Do Lists as part of some other system such as a project management system.

Linked entries

If you import a list from another workspace or target, or from a previous version of PowerBuilder, linked entries will display in the list but the links will not be active.

Working with entries on the To-Do List

The following table tells you how to work with entries on the To-Do List.

To

Do this

See linked entries

Move the pointer over the entries. A hand displays when the entry you are over is linked.

Use a linked entry to get to a painter or wizard

Double-click the linked entry or select it and then select Go To Link from the pop-up menu.

Add an entry with no link

Select Add from the pop-up menu.

Add a linked entry to a painter that edits objects

With the painter open, select Add Linked from the pop-up menu.

Add an entry for a specific target

If the To-Do List is open, select the target from the drop-down list at the top of the To-Do List and add the entry.

If the To-Do List is closed, select a target in the System Tree, open the To-Do List, and add the entry.

Add an entry for the workspace

Select Current Workspace from the drop-down list at the top of the To-Do List and add the entry.

Change the list that displays

Select a specific target or Current Workspace from the drop-down list at the top of the To-Do List. To display tasks for all targets and the workspace, select All Items.

Change an entry's position on the list

Drag the entry to the position you want.

Edit or delete an entry

Select Edit or Delete from the pop-up menu.

Delete checked entries or all entries

Select Delete Checked or Delete All from the pop-up menu.

Check or uncheck an entry

Click in the margin to the left of the entry or select an entry and then select Check/Uncheck from the pop-up menu.

Export a To-Do List

Select Export from the pop-up menu, name the To-Do List text file, and click Save.

Import a To-Do List

Select Import from the pop-up menu, navigate to an exported To-Do List text file, and click Open.


Using the file editor

One of the tools on the PowerBar and Tools menu is a text editor that is always available. Using the editor, you can view and modify text files (such as initialization files and tab-separated files with data) without leaving PowerBuilder. Among the features the file editor provides are find and replace, undo, importing and exporting text files, and dragging and dropping text.

Setting file editing properties

The file editor has font properties and an indentation property that you can change to make files easier to read. If you do not change any properties, files have black text on a white background and a tab stop setting of 3 for indentation. Select Design>Options from the menu bar to change the tab stop and font settings.

Editor properties apply elsewhere

When you set properties for the file editor, the settings also apply to the Function painter, the Script view, the Source editor, the Interactive SQL view in the Database painter, and the Debug window.

Dragging and dropping text

To move text, simply select it, drag it to its new location, and drop it. To copy text, press the Ctrl key while you drag and drop the text.

Using online help

PowerBuilder help contains the core PowerBuilder documents.

Accessing help

The following table lists the ways you can access help.

Approach

What it does

Use the help menu on the menu bar

Displays the help contents, the What's New in PowerBuilder help, or help for the current painter.

In a wizard, click the help button [?] in the upper right corner of the window

The pointer displays with a question mark so you can get context-sensitive help. Point and click in a field you need help on.

In the Properties view in a painter, select help from the pop-up menu on any tab page

Displays a help topic from which you can get help on the properties, events, and functions for the object or control whose properties are displaying in the Properties view.

Add a help button to the PowerBar and use it

Displays the help contents.

Press F1

Displays the help contents.

Press Shift+F1 in the Script view or Function painter

Displays context-sensitive help about the function, event, or keyword under the cursor.

Select Help from the pop-up menu in the Browser

Displays help for the Browser or for the selected object, control, or function.

Click the Help button in a dialog box

Displays information about that dialog box.


Building an application

This section describes the basic steps you follow when building a traditional client/server application. After completing step 1, you can define the objects used in your application in any order as you need them.

To build a traditional client/server application:

  1. Create the application (using a New wizard) and specify the library list for the application.

    When you use a Start wizard, you create the Application object, which is the entry point into the application. The Application object contains the name of the application and specifies the application-level scripts.

    See Working with Targets and Part 3, "Coding Fundamentals."

  2. Create windows.

  3. Place controls in the window and build scripts that specify the processing that will occur when events are triggered.

    See Working with Windows.

  4. Create menus.

    Menus in your windows can include a menu bar, drop-down menus, cascading menus, and pop-up menus. You define the menu items and write scripts that execute when the items are selected.

    See Working with Menus and Toolbars.

  5. Create user objects.

    If you want to be able to reuse components that are placed in windows, define them as user objects and save them in a library. Later, when you build a window, you can simply place the user object on the window instead of having to redefine the components.

    See Working with User Objects.

  6. Create functions, structures, and events.

    To support your scripts, you define functions to perform processing unique to your application and structures to hold related pieces of data. You can also define your own user events.

    See Working with User-Defined Functions, Working with User Events, and Working with Structures.

  7. Create DataWindow objects.

    Use these objects to retrieve data from the database, format and validate data, analyze data through graphs and crosstabs, and update the database.

    See Defining DataWindow Objects and the DataWindow Programmers Guide.

  8. Test and debug your application.

    You can run your application at any time. If you discover problems, you can debug your application by setting breakpoints, stepping through your code, and looking at variable values during execution. You can also create a trace file when you run your application and use PowerBuilder's profiling tools to analyze the application's performance and logical flow.

    See Debugging and Running Applications, and Tracing and Profiling Applications.

  9. Prepare an executable.

    When your application is complete, you prepare an executable version to distribute to your users.

    See Creating Executables and Components.

Using other books

This book tells you how to use PowerBuilder painters and tools.

For programming techniques for building applications and building clients and components for application servers, see Application Techniques.

For programming techniques related to DataWindows, see the DataWindow Programmers Guide.