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.
Applies to
ListBox and PictureListBox controls
Syntax
|
1 |
listboxname.Top ( ) |
|
Argument |
Description |
|---|---|
|
listboxname |
The name of the ListBox or PictureListBox in which you |
Return value
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 2 |
integer Num Num = lb_Contacts.Top() |
If the user has not scrolled the list in lb_Contacts, then Num is
set to 1:
|
1 2 |
integer Num Num = lb_Contacts.Top() |
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 2 3 4 |
integer Num Num = lb_Contacts.SelectedIndex() IF lb_Contacts.Top() <> Num THEN & lb_contacts.SetTop(Num) |
See also