Syntax 3: For ListView controls
Description
Search for the next item relative to a specific location in the
ListView control.
Applies to
ListView controls
Syntax
|
1 |
listviewname.FindItem ( startindex, direction, focused, selected, cuthighlighted, drophighlighted ) |
|
Argument |
Description |
|---|---|
|
listviewname |
The ListView control for which you want to search for |
|
startindex |
The index number from which you want your search to |
|
direction |
The direction in which to search. Values are: DirectionAll! DirectionUp! DirectionDown! DirectionLeft! DirectionRight! |
|
focused |
If set to true, the search looks for the next ListView |
|
selected |
If set to true, the search looks for the next ListView |
|
cuthighlighted |
If set to true, the search looks for the next ListView |
|
drophighlighted |
If set to true, the search looks for next ListView item |
Return value
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 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
listviewitem l_lvi integer li_index, li_startindex li_startindex = lv_list.SelectedIndex() li_index = lv_list.FindItem(li_startindex, & DirectionDown!, FALSE, FALSE ,FALSE, FALSE) IF li_index = -1 THEN MessageBox("Error", "Item not found.") ELSE lv_list.GetItem (li_index, l_lvi) l_lvi.HasFocus = TRUE l_lvi.Selected = TRUE lv_list.SetItem(li_index,l_lvi) END IF |
See also