Working with libraries
The Library painter is designed for working with PowerBuilder
libraries.
Displaying libraries and objects
What you see in the views
In the Tree view, you can expand items and see the folders,
libraries, or objects they contain. The List view displays the contents
of a selection in the Tree view. For example, here the APP_EMP.PBL
has been selected in the Tree view (and then expanded). When the
PBL was selected, its contents displayed in the List view.

To expand or collapse an item in the Tree view:
-
Double-click the item.
If the item contains libraries or objects, they display in
the List view.
To display the contents of an item in the List
view:
-
Select the item in the Tree view.
or
Double-click the item in the List view.
Using drag and drop to expand items
You can drag and drop items to expand them and see the contents:
| If you drag an item from a | And drop it in a | This happens |
|---|---|---|
| Tree view or List view | List view | The List view sets the item as the root and displays the contents |
| Tree view or List view | Tree view | The Tree view expands to that item |
For example, you can drag a library from the Tree view and
drop it in the List view to quickly display the objects the library
contains in the List view. If you are using one Tree view and many
List views as described in the next section, you can drag a specific
library from the Tree view to each List view so each List view contains
the contents of a specific library.
For information about using drag and drop to copy or move
items, see “Copying, moving, and
deleting objects”.
Using
the popup menu
Like the other painters, the Library painter has a popup menu
that provides menu items that apply to the selected item in the
Tree view or the List view. For example, from a library’s
popup menu, you can delete, optimize, print the directory, specify
the objects that display in that library, search the library, and import
objects into it.
The actions available from an object’s popup menu
depend on the object type. For PowerBuilder objects that you can
work with in painters, you can edit the object in a painter or in
the Source editor, copy, move, or delete the object, export it to
a text file, search it, regenerate it, or send it to a printer.
You can also preview and inherit from some objects. For most of
these actions, the object must be in a library in your current workspace.
Controlling columns that display in the List view
You can control whether to display the last modification date,
compilation date, size, and comments (if a comment was created when
an object or library was created) in the List view.
To control the display of columns in the List
view:
-
Select Design>Options from the
menu bar. -
On the General tab page, select or clear these
display items: Modification Date, Compilation Date, Sizes, and Comments.
Selecting objects
In the List view, you can select one or more libraries or
objects to act on.
To select multiple entries:
-
In the List view, use ctrl+click (for
individual entries) and shift+click (for
a group of entries).
To select all entries:
-
In the List view, select an object and
then click the Select All button on the PainterBar.
Filtering the display of objects
You can change what objects display in expanded libraries.
Settings are remembered PowerBuilder records your preferences in the Library section
of the PowerBuilder initialization file so the next time you open
the Library painter, the same objects and information are displayed.
Specifying which objects display in all libraries
Initially in the Tree and List views, the Library painter
displays all objects in libraries that you expand, as well as targets,
workspaces, folders, and files. You can specify that the Library
painter display only specific kinds of objects and/or objects
whose names match a specific pattern. For example, you can limit
the display to only DataWindow objects, or limit the display to
windows that begin with w_emp.
To restrict which objects are displayed:
-
Select Design>Options from the
menu bar and select the Include tab. -
Specify the display criteria:
- To limit the display
to entries that contain specific text in their names, enter the
text in the Name box. You can use the wildcard characters question
mark (?) and asterisk (*) in the string: ? represents one character, * represents
any string of characters. The default is all entries of the selected
types. - To limit the display to specific entry types, clear
the checkboxes for the entry types that you do not want to display.
The default is all entries.
- To limit the display
-
Click OK.
The Options property sheet closes.
-
In the Tree view, expand libraries or select a
library to display the objects that meet the criteria.
Overriding the choices you made for a specific
view
In either the Tree view or the List view, you can override
your choice of objects that display in all libraries by selecting
a library, displaying the library’s popup menu, and then
clearing or selecting items on the list of objects.

Creating and deleting libraries
To create a library:
-
Click the Create button.
or
Select Entry>Library>Create from the
menu bar.The Create Library dialog box displays showing the current
directory and listing the libraries it contains:
-
Enter the name of the library you are creating
and specify the directory in which you want to store it.The file is given the extension .PBL.
-
Click Save.
The library property sheet displays.
-
Enter any comments you want to associate with
the library.It is good practice to add comments to describe the purpose
of a library. -
Click OK.
PowerBuilder creates the library.
To delete a library:
-
In either the Tree view or the List view,
select the library you want to delete. -
Select Entry>Delete from the menu bar.
or
Select Delete from the popup menu.
Restriction You cannot delete a library that is in the current target’s
library search path.The Delete Library dialog box displays showing the library
you selected. -
Click Yes to delete the library.
The library and all its entries are deleted. You cannot get
them back.
Creating and deleting libraries during execution You can use the LibraryCreate and LibraryDelete functions
in scripts to create and delete libraries.
For information about these functions, see
the PowerScript Reference
.
Filtering the display of libraries and folders
In either the Tree view or the List view, you can control
what displays when you expand a drive or folder. An expanded drive
or folder can display folders, workspaces, targets, files, and libraries.
To control display of the contents of drives and
folders:
-
In either the Tree or List view, select
a drive or folder, select Show from the popup menu, and select or
clear items from the cascading menu.
Working in the current library
In PowerBuilder,
the current library is the library that contains the object most recently
opened or edited. That library becomes the default for Open and Inherit.
If you click the Open or Inherit button in the PowerBar, the current library
is the one selected in the Libraries list.
You can display the current library in the Library painter.
To display objects in the current library:
-
Click in the Tree view or the List view
and then click the Display Most Recent Object button on the PainterBar.The library that contains the object you opened or edited
last displays in the view you selected with the object highlighted.
Opening and previewing objects
You can open and preview objects in the current workspace.
Opening PowerBuilder objects
PowerBuilder objects, such as windows and menus, are only
opened if they are in a PBL in the current workspace.
To open an object:
-
In either the Tree view or the List view,
double-click the object.or
Select Edit from the object’s popup menu.
PowerBuilder takes you to the painter for that object and opens
the object. You can work on the object and save it as you work.
When you close it, you return to the Library painter.
Opening other objects
The Library painter allows you to open most of the different
file types it displays. When you double-click on an object, PowerBuilder
first determines if the object can be opened in the File editor.
For example, files with the extensions .txt, .ini, and .sr* open
in the File editor.
If not, PowerBuilder determines if the object can be opened
in a painter or HTML editor.
Finally, PowerBuilder checks to see if the object is associated
with a program in the HKEY_CLASSES_ROOT section
of the Windows registry and, if so, launches the application.
You can run windows and preview DataWindow objects from the
Library painter.
To preview an object in the Library painter:
-
Select Run/Preview from the object’s
popup menu.
Copying, moving, and deleting objects
As the needs of your target change, you will want to be able
to rearrange the objects in libraries. Perhaps you are dividing
your target into different libraries. To do that, you will want
to copy and move objects between libraries or delete objects that
you no longer need.
To copy objects using drag and drop:
-
In the Tree view or the List view, select
the objects you want to copy. -
Drag the objects to a library in either view (or
if the contents of a library are displaying in the List view, you
can drop it there).PowerBuilder copies the objects. If an object with the same
name already exists, PowerBuilder prompts you and if you allow it,
replaces it with the copied object.
To move objects using drag and drop:
-
In the Tree view or the List view, select
the objects you want to move. -
Press and hold shift and drag
the objects to a library in either view (or if the contents of a
library are displaying in the List view, you can drop it there).PowerBuilder moves the objects and deletes them from the source
library. If an object with the same name already exists, PowerBuilder prompts
you and if you allow it, replaces it with the moved object.
To copy or move objects using a button or menu
item:
-
Select the objects you want to copy or
move to another library. -
Click the Copy button or the Move button.
or
Select Copy or Move from the popup menu.
or
Select Entry>Library Item>Copy or
Entry>Library Item>Move from the menu bar.The Select Library dialog box displays.
-
Select the library to which you want to copy or
move the objects and click OK.
To delete objects:
- Select the objects you want to delete.
-
Click the Delete button.
or
Select Delete from the popup menu.
or
Select Entry>Delete from the menu bar.
You are asked to confirm the first deletion.
Being asked for confirmation By default, PowerBuilder asks you to confirm each deletion.
If you don’t want to have to confirm deletions, select
Design>Options to open the Options property sheet for the
Library painter and clear the Confirm on Delete checkbox in the
General tab page.PowerBuilder records this preference as the DeletePrompt variable
in the Library section of the PowerBuilder initialization file. -
Click Yes to delete the entry or Yes To All to
delete all entries. Click No to skip the current entry and go on
to the next selected entry.
Setting the root
In either the Tree view or the List view, you can set the
root location of the view.
To set the root of the current view:
-
In either view, select View>Set
Root from the menu bar.or
Select Set Root from the popup menu.
-
If you want the root to be a directory or library,
type the path or browse to the path.
Setting the root to the current workspace
In the System Tree, the default root is the current workspace.
If you prefer to work in the Library painter, you may find it convenient
to set the root to the current workspace. Using the current workspace
as your root is particularly helpful if you are using many libraries
in various locations (such as PFC libraries and libraries you created),
because they are all displayed in the same tree.
Moving back, forward, and up one level
You can also set a new root by moving back to where you were
before, moving forward to where you just were, or for the List view,
moving up a level.
To move back, forward, or up one level:
-
Select View>Back, View>Forward,
or View>Up One Level from the menu bar.or
Select Back, Forward, or Up One Level from the popup
menu.The name of the location you are moving back to or forward
to is appended to Back and Forward.
Modifying comments
You can use comments to document your objects and libraries.
For example, you might use comments to describe how a window is
used, specify the differences between descendent objects, or identify
a PowerBuilder library.
You can associate comments with an object when you first save
it in a painter. You can add or modify comments for objects and
libraries in the System Tree or Library painter. If you want to
modify comments for a set of objects, you can do so quickly in the
List view.
To modify comments for multiple objects:
-
In the List view, select the objects you
want. -
Select Entry>Properties from the menu
bar.or
Select Properties from the popup menu.
PowerBuilder displays the Properties dialog box. The information
that displays is for one of the objects you selected. You can change
existing comments, or, if there are no comments, you can enter new
descriptive text. -
Click OK when you have finished with the first
one.If you do not want to change the comments for an object, click
OK. The next object displays. -
Enter comments and click OK for each object until
you have finished.If you want to stop working on comments before you finish
with the objects you selected, click Cancel. The comments you’ve
entered until the most recent OK are retained and display in the
List view.
To modify comments for a library:
- Select the library you want.
-
Click the Properties button.
or
Select Library from the popup menu.
- Add or modify the comments.