Extensions Reference
Extensions Reference > exDialogs
dlgListPromptGetSelItem
int dlgListPromptGetSelItem();
Returns the index of the selected item in a list selection dialog
The DLGLISTPROMPTGETSELITEM function returns the index of text string selected by the user in the dialog previously shown by dlgListPrompt. This function must only be called after dlgListPrompt has been successfully called and closed using the OK button.
This function is useful when working with arrays. If the contents of an array have been added to the list data in sequence, the index returned by this function will match the index of the array element that was selected. This is more efficient than retrieving the selected string using dlgListPromptGetSelString and comparing it to each array element.
Parameters
None
Return Value
The index of the text string selected by the user.
Example Code
// Reset the list before use
dlgListPromptReset();
// Add some items for selection
dlgListPromptAddItem("list item 1");
dlgListPromptAddItem("list item 2");
// Open the prompt dialog with the specified options
if(dlgTextPrompt("The Title", "The Frame", Select an item ",
-1, -1, True) == True)
{
// Retrieve the index of the selected item
int iSelected = dlgListPromptGetSelString();
}