Syntax 3 For ListView controls
Description
Search for the next item relative to a specific location in
the ListView control.
Controls
ListView controls
Syntax
|
1 |
<span>listviewname</span><span>.FindItem</span> ( <span>startindex, direction, focused, selected, <br> cuthighlighted, drophighlighted</span> ) |
|
Argument |
Description |
|---|---|
|
listviewname |
The ListView control for which you want |
|
startindex |
The index number from which you want |
|
direction |
The direction in which to search. Values
|
|
focused |
If set to true, the |
|
selected |
If set to true, the |
|
cuthighlighted |
If set to true, the |
|
drophighlighted |
If set to true, the |
Return Values
Integer. Returns the index of the item
found if it succeeds and -1 if an error occurs.
Usage
The search starts from startindex + 1
by default. If you want to search from the beginning, specify 0.
FindItem does not select the item it finds.
You must use the item’s selected property in conjunction
with FindItem to select the resulting match.
If focused, selected, cuthighlighted,
and drophighlighted are set to false, the search
finds the next item in the ListView control.
Examples
This example uses FindItem to
search from the selected ListView item:
|
1 |
listviewitem l_lvi |
|
1 |
integer li_index li_startindex |
|
1 |
|
1 |
li_startindex = lv_list.SelectedIndex() |
|
1 |
li_index = lv_list.<span>FindItem</span>(li_startindex, & |
|
1 |
DirectionDown!, FALSE, FALSE ,FALSE, FALSE) |
|
1 |
|
1 |
IF li_index = -1 THEN |
|
1 |
MessageBox("Error", "Item not found.") |
|
1 |
ELSE |
|
1 |
lv_list.GetItem (li_index, l_lvi) |
|
1 |
l_lvi.HasFocus = TRUE |
|
1 |
l_lvi.Selected = TRUE |
|
1 |
lv_list.SetItem(li_index,l_lvi) |
|
1 |
END IF |