The Field_GetInsertPosFromVisualPos() function retrieves the insertion position of an item in a list field (list box, drop-down list, button drop list, or visual switch) based on its visual position.
• list_field – The list field for which information is being retrieved.
• visual_pos – An integer specifying the visual position of the item for which the insertion position is being returned. The value 1 indicates the first item at the top of the list.
An integer containing the insertion position of the item.
When static items are added to list fields, either in the data type definition or with sanScript, they are added in insertion order. The value of the list field is based on the insertion position of the item selected. If the list is sorted, the visual order of the items may be different than the insertion order. If you know the visual position of an item, use this function to retrieve the item’s insertion position.
If you are using the add item statement to add items to a list field, be sure to use the redraw statement to resort the items before using the Field_GetInsertPosFromVisualPos() function.