API:ListBoxGetDataIndex
From RoR Wiki
UI Lua API · ListBox functions
Version: WAR 1.4.8
Returns the data index shown in one of a ListBox's visible rows.
dataIndex = ListBoxGetDataIndex(listBoxName, rowIndex)
Arguments
- listBoxName
string– Name of the ListBox.- rowIndex
number– Number of the visible row, counted from 1 at the top of the list as it is currently scrolled.
Returns
- dataIndex
number– The entry of the display order (see ListBoxSetDisplayOrder) shown in that row. This is normally an index into the ListBox's data table.
Details
- The scroll position is taken into account: when the list is scrolled down by 5 rows, row 1 shows display-order entry 6.
- If
rowIndexis less than 1, or the row is past the end of the display order, the function returns no value (nil). - The function needs at least two arguments and only reads the last two. Any extra arguments placed in front of them are ignored.
Errors
Error in function call 'ListBoxGetDataIndex': Window %s does not existError in function call 'ListBoxGetDataIndex': Window %s is not a ListBox
Example
From default/ea_auctionhousewindow/source/auctionwindow.lua:
local dataIndex = ListBoxGetDataIndex( RESULTS_LIST, row ) local rowIsSelected = (windowData.currentlySelectedRow == dataIndex) ButtonSetPressedFlag(rowName, rowIsSelected) ButtonSetStayDownFlag(rowName, rowIsSelected)
