- Documentation
- Client functions
- guiCreateGridList
Function
guiCreateGridList
Creates a list with columns (a table). Add columns with guiGridListAddColumn and rows with guiGridListAddRow.
Syntax
gui-gridlist guiCreateGridList(float x, float y, float width, float height, bool relative [, element parent = nil])Arguments
xfloat- X position.
yfloat- Y position.
widthfloat- Width.
heightfloat- Height.
relativebool- Relative values.Optional in MTA:SA: bool relative = false
parentelement, optional = nil- Parent.
Differences from MTA:SA
- Arguments in a different colour differ from MTA:SA.
In MTA:SA
guiCreateGridList(float x, float y, float width, float height, bool relative = false, gui-element parent = nil)Returns
The list.
Example
A player list with health.
local win = guiCreateWindow(100, 100, 360, 400, "Gracze", false)
local list = guiCreateGridList(10, 35, 340, 355, false, win)
guiGridListAddColumn(list, "Nick", 0.7)
guiGridListAddColumn(list, "Zdrowie", 0.2)
for _, p in ipairs(getElementsByType("player")) do
local row = guiGridListAddRow(list, getPlayerName(p), math.floor(getElementHealth(p)))
guiGridListSetItemData(list, row, 1, p)
end
See also
guiGridListAddColumnAdds a column to a list. Width is a fraction of the list width.guiGridListAddRowAdds a row. You can pass the texts of the following cells right away as extra arguments.guiGridListGetSelectedItemReturns the selected row (from 0) and column (from 1). When nothing is selected:-1, -1.