RETRY

IndexToItemId, ItemIdToIndex

These methods convert between the two numbering schemes for items in list and combo boxes.

Usage

FUNCTION IndexToItemId LPARAMETERS nIndex   FUNCTION ItemIdToIndex LPARAMETERS nItemId
Each item added to a list or combo has two numbers assigned to it. ItemId is a unique, unchanging number. Index is based on the item's current position in the list, and changes as items are added and removed, and when the Sorted property changes. (See AddItem for a complete explanation of the two numbering systems.)

These methods convert between ItemIds and Indexes. They're not needed often, since pretty much everything for handling lists and combos comes in two forms—one for Indexes and one for ItemIds. The only thing we can think of that doesn't offer both approaches is Picture, which uses only the indexes. However, the conversion functions are also handy when the list has mover bars and is based on or related to an array. The functions let you process items in the order they appear, but still connect to your outside arrays based on the ItemID.

Example

* Convert the currently selected index to an item id nItemId = IndexToItemId( ListIndex )

See Also

AddItem, AddListItem, ComboBox, ListBox, ListIndex, ListItemId, RowSourceType


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