Top PowerScript function
Description
Obtains the index number of the first visible item in a ListBox
control. Top lets you to find out how the user
has scrolled the list.
Controls
ListBox and PictureListBox controls
Syntax
1 |
<span>listboxname</span>.<span>Top</span> ( ) |
Argument |
Description |
---|---|
listboxname |
The name of the ListBox or PictureListBox |
Return Values
Integer. Returns the index of the first
visible item in listboxname. Top returns
-1 if an error occurs. If listboxname is null, Top returns null.
Usage
The index of a list item is its position in the full list
of items, regardless of how many are currently visible in the control.
Examples
If item 15 has been scrolled to the top of the list
in lb_Contacts, then this example
sets Num to 15:
1 |
integer Num |
1 |
Num = lb_Contacts.<span>Top</span>() |
If the user has not scrolled the list in lb_Contacts,
then Num is set to 1:
1 |
integer Num |
1 |
Num = lb_Contacts.<span>Top</span>() |
If the item at the top of the list in lb_Contacts is
not the currently selected item, the following statements scroll
the currently selected item to the top:
1 |
integer Num |
1 |
Num = lb_Contacts.SelectedIndex() |
1 |
IF lb_Contacts.<span>Top</span>() <> Num THEN & |
1 |
lb_contacts.SetTop(Num) |