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

Syntax 4: For TreeView controls – PB Docs 2022 – PowerBuilder Library

Syntax 4: For TreeView controls – PB Docs 2022

Syntax 4: For TreeView controls

Description

Find an item based on its position in a TreeView control.

Applies to

TreeView controls

Syntax

Argument

Description

treeviewname

The name of the TreeView control in which you want to
find a specified item.

navigationcode

A value of the TreeNavigation enumerated datatype
specifying the relationship between itemhandle and the item
you want to find. See the table in Usage note for a list of
valid values.

itemhandle

A long for the handle of an item related via
navigationcode to the item for which you are searching.

Return value

Long.

Returns the item handle if it succeeds and -1 if an error
occurs.

Usage

FindItem does not select the item it finds. You must use the
item’s selected property in conjunction with FindItem to select the
result of the FindItem search.

FindItem never finds a collapsed item, except when looking for
ChildTreeItem!, which causes an item to expand. CurrentItem! is not
changed until after the clicked event occurs. To return the correct
handle for the current item when the user clicks it, create a custom
event to return the handle and post it in the clicked event.

If navigationcode is RootTreeItem!, FirstVisibleTreeItem!,
CurrentTreeItem!, or DropHighlightTreeItem!, set itemhandle to 0.

The following table shows valid values for the navigationcode
argument.

Navigationcode value

What FindItem finds

RootTreeItem!

The first item at level 1. Returns -1 if no items
have been inserted into the control.

NextTreeItem!

The sibling after itemhandle. A sibling is an item
at the same level with the same parent. Returns -1 if there are
no more siblings.

PreviousTreeItem!

The sibling before itemhandle. Returns -1 if there
are no more siblings.

ParentTreeItem!

The parent of itemhandle. Returns -1 if the item is
at level 1.

ChildTreeItem!

The first child of itemhandle. If the item is
collapsed, ChildtreeItem! causes the node to expand. Returns -1
if the item has no children or if the item is not populated
yet.

FirstVisibleTreeItem!

The first item visible in the control, regardless
of level. The position of the scroll bar determines the first
visible item.

NextVisibleTreeItem!

The next expanded item after itemhandle, regardless
of level. The NextVisible and PreviousVisible values allow you
to walk through all the visible children and branches of an
expanded node. Returns -1 if the item is the last expanded item
in the control.

To scroll to an item that is beyond
the reach of the visible area of the control, use FindItem and
then SelectItem.

PreviousVisibleTreeItem!

The next expanded item before itemhandle,
regardless of level. Returns -1 if the item is the first root
item.

CurrentTreeItem!

The selected item. Returns -1 if the control never
had focus and nothing has been selected.

DropHighlightTreeItem!

The item whose DropHighlighted property was most
recently set. Returns -1 if the property was never set or if it
has been set back to false because of other activity in the
control.

Examples

To return the correct handle when the current item is clicked,
place this code in a custom event that is posted in the item’s clicked
event:

This example finds the first item on the first level of a TreeView
control:

See also

DeleteItem

GetItem

InsertItem

SelectItem


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