Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

About TreeView controls – PB Docs 70 – PowerBuilder Library

About TreeView controls – PB Docs 70

About TreeView controls

TreeView controls provide a way to represent hierarchical
relationships within a list. The TreeView provides a standard interface
for expanding and collapsing branches of a hierarchy:

uitv01.gif

When to use a TreeView You use TreeViews in windows and custom visual user objects.

Choose a TreeView instead of a ListBox or ListView when your
information is more complex than a list of similar items and when
levels of information have a one-to-many relationship.

Choose a TreeView instead of a DataWindow control when your
user will want to expand and collapse the list using the standard
TreeView interface.

Hierarchy of items Although items in a TreeView can be a single, flat list like
the report view of a ListView, you tap the power of a TreeView when
items have a one-to-many relationship two or more levels deep. For
example, your list might have one or several parent categories with
child items within each category. Or the list might have several
levels of subcategories before getting to the end of a branch in
the hierarchy:

Number of levels in each branch You don’t have to have the same number of levels
in every branch of the hierarchy if your data requires more levels
of categorization in some branches. However, programming for the
TreeView is simpler if the items at a particular level are the same
type of item, rather than subcategories in some branches and detail
items in others.

For example, in scripts you might test the level of an item
to determine appropriate actions. You can call the SetLevelPictures
function to set pictures for all the items at a particular level.

Content sources for a TreeView

For most of the list types in PowerBuilder, you can add items
in the painter or in a script, but for a TreeView, you have to write
a script. Generally, you will populate the first level (the root
level) of the TreeView when its window opens. When the user wants
to view a branch, a script for the TreeView’s ItemPopulate event
can add items at the next levels.

The data for items can be hardcoded in the script, but it
is more likely that you will use the user’s own input or
a database for the TreeView’s content. Because of the one-to-many
relationship of an item to its child items, you may use several
tables in a database to populate the TreeView.

For an example using DataStores, see “Using DataWindow information
to populate a TreeView”
.

Pictures for items

Pictures are associated with individual items in a TreeView.
You identify pictures you want to use in the control’s
picture lists and then associate the index of the picture with an
item.

Generally, pictures are not unique for each item. Pictures
provide a way to categorize or mark items within a level. To help
the user understand the data, you might:

  • Use a different picture for each level
  • Use several pictures within a level to identify
    different types of items
  • Use pictures on some levels only
  • Change the picture after the user clicks on an item

Pictures aren’t required You don’t have to use pictures if they don’t
convey useful information to the user. Item labels and the levels
of the hierarchy may provide all the information the user needs.

Appearance of the TreeView

You can control the appearance of the TreeView by setting
property values. Properties that affect the overall appearance are:

Properties Effect when set
HasButtons Puts + and – buttons before
items that have children, showing the user whether the item is expanded
or collapsed
HasLines and LinesAtRoot Displays lines connecting items within
a branch and connecting items at the root level
Checkboxes Replaces the state image with checked
and unchecked checkboxes
TrackSelect Changes the appearance of an item as
the mouse moves over it
FullRowSelect Highlights entire row of selected item
SingleExpand Expands the selected item and collapses
the previously selected item automatically
Indent Sets the amount an item is indented
Font properties Specifies the font for all the labels
Various picture properties Controls the pictures and their size

For more information about these properties,
see Objects and Controls
.

User interaction

Basic TreeView functionality allows editing labels, deleting
items, expanding and collapsing branches, and alphabetic sorting
without any scripting on your part. For example, label editing can
occur when the user clicks a second time on a selected item, and
an item can be deleted when the user presses the delete key.
If you don’t want to allow these actions, properties let
you disable them.

You can customize any of these basic actions by writing scripts.
Events associated with the basic actions let you provide validation
or prevent an action from completing. You can also implement other
features such as adding items, dragging items, and customized sorting.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x