Using the Code Examples application
You run the Code Examples application from the development
environment.
To run the Code Examples application from the
PowerBuilder environment:
-
Select File>Select Application
from the menu bar and select the Browse tab. -
Navigate to the Code ExamplesExamples
App directory, expand pbexamfe.pbl, select the examples application,
and click OK. -
Select File>Library List and click the
Browse button. -
Select all the PBLs in the directory and click
OK. - Click the Run button on the PowerBar.
Browsing the examples
When the Code Examples application opens, the left pane contains
an expandable tree view listing the categories of examples available.
Some examples appear in more than one category. For example, the
Business Class example is listed under Inheritance and User Objects.
If you’re looking for examples showing how to work with
a specific feature, such as DataStores or DataWindows, expand that
category and look at the example names.
When you select an example in the left pane, a description
of the example and the techniques it demonstrates displays on the
right:
New examples
When you expand the tree view to show the example names, you
will see an icon next to each name. These icons tell you whether
the example is new or enhanced, and whether the example demonstrates
features that are new in PowerBuilder 7. You can use the
dropdown listbox at the top of the pane to restrict the display
to the kind of example you want.
Finding examples
If you’re looking for ways to work with a specific PowerBuilder object
class or feature, you can use the categories in the Examples pane
and the descriptions to locate examples. If you’re looking
for examples using a specific event, function, or user-defined object,
use the Search pane.
To search for a function, event, or object:
-
Click the Search tab in the Code Examples
main window. - Select a radio button in the Search On groupbox.
-
Select the item you want in the dropdown listbox
and click Perform Search.The names of all the examples that use the function, event,
or object you searched for display:
Running and examining examples
Once you’ve located an example that performs some
processing you want to learn about, you can run it to examine how
it works and look at the code (and copy it if you want to).
Running an example
To run the highlighted example, double-click it or click Run!.
You can get Help on how to use the example and what it’s
doing by clicking the Help button on the example’s main
window.
Examining the code
To see all the objects used in an example, click the Related
Objects tab on the right pane and click the plus signs to expand
items:
Double-click the icon for a script or function to examine
it.
Using examples in the development environment
Running the Code Examples application and looking at the code
for an example gives you a lot of information, but if you open objects
in the examples in the development environment you can examine them
in more depth.
For example, you can open any object in a painter, examine
the inheritance hierarchy in the Browser, and step through an example
in the Debugger. You can even copy objects to your own application
in the Library painter or code fragments in the Script view.
A collection of programming techniques you can use
to take advantage of PowerBuilder object-oriented features and PowerScript
language elements. Includes a description of the ClassDefinition
object that provides information about the class of a PowerBuilder object.