Movable

NewIndex, NewItemId

These properties tell you the index and itemid of the item you most recently added to a list or combo box.

Usage

nIndexAssigned = oObject.NewIndex nItemIdAssigned = oObject.NewItemId
To understand the distinction between index and itemid, see the entries for AddItem and for ListIndex and ListItemId. These two have the same division of labor as those last two properties.

You're far more likely to need NewItemId than NewIndex. If you're adding a series of items to a multi-column list, NewItemId can be a big help. As long as you use it every time, you don't have to worry about finding unique itemids.

Example

* Use NewItemId to avoid counting as you add a series of items * to a multi-column list. * This is the same example as in the AddListItem entry,  * except that NewItemId is used instead of an explicit counter   * Fill a list box with the names and titles from Employee * This code might be in the Init method of the list box This.ColumnCount = 3 This.ColumnWidths = "75,60,150"   SELECT Employee SCAN    This.AddListItem(Last_Name)    This.AddListItem(First_Name, This.NewItemId, 2)    This.AddListItem(Title, This.NewItemId, 3) ENDSCAN   * To see them in alpha order, add This.Sorted=.T.

See Also

AddItem, AddListItem, ComboBox, ListBox, ListCount, ListIndex, ListItemId


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net