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

Functions for inserting items – PB Docs 125 – PowerBuilder Library

Functions for inserting items – PB Docs 125

Functions for inserting items

There are several functions for adding items to a TreeView
control, as shown in Table 8-2.

Table 8-2: Functions for adding items to
TreeView control

This
function

Adds an item here

InsertItem

After a sibling item for the specified
parent.

If no siblings exist, you must use one of the other insertion functions.

InsertItemFirst

First child of the parent item.

InsertItemLast

Last child of the parent item.

InsertItemSort

As a child of the parent item in alphabetic
order, if possible.

For all the InsertItem functions, the SortType
property can also affect the position of the added item.

There are two ways to supply information about the item you
add, depending on the item properties that need to be set.

Method 1: specifying the label and picture index
only

You can add an item by supplying the picture index and label.
All the other properties of the item will have default values. You
can set additional properties later as needed, using the item’s
handle.

Example

This example inserts a new item after the currently selected
item on the same level as that item. First it gets the handles of
the currently selected item and its parent, and then it inserts
an item labeled Hindemith after the currently
selected item. The item’s picture index is 2:

Method 2: setting item properties in a TreeViewItem structure

You can add items by supplying a TreeViewItem structure with
properties set to specific values. The only required property is
a label. Properties you might set are shown in Table 8-3.

Table 8-3: TreeViewItem properties

Property

Value

Label

The text that is displayed for the item.

PictureIndex

A value from the regular picture list.

SelectedPictureIndex

A value from the regular picture list,
specifying a picture that is displayed only when the item is selected.
If 0, no picture is displayed for the item when selected.

StatePictureIndex

A value from the State picture list.
The picture is displayed to the left of the regular picture.

Children

Must be TRUE if you
want double-clicking to trigger the ItemPopulate event. That event
script can insert child items.

Data

An optional value of any datatype that
you want to associate with the item. You might use the value to
control sorting or to make a database query.

Example

This example sets all these properties in a TreeViewItem structure before
adding the item to the TreeView control. The item is inserted as
a child of the current item:

For more information about inserting items
into a TreeView control, see the PowerScript Reference.


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