guiGridListSetSelectionMode | Multi Theft Auto: Wiki Skip to content

guiGridListSetSelectionMode

Client-side
Server-side
Shared

Pair: guiGridListGetSelectionMode

This function sets the selection mode of a gui gridlist. For example, the MTA server browser selects a whole row, while the Controls dialog selects a single cell. To select multiple items you must be holding down ctrl.

OOP Syntax Help! I don't understand this!

  • Method:gui-gridlist:setSelectionMode(...)
  • Variable: .selectionMode

Syntax

bool guiGridListSetSelectionMode ( ​gui-gridlist gridlist, ​int mode )
Required arguments
  • gridlist: The gridlist in which you wish to set the selection mode.
  • mode: The mode of the selection.
    • 0: Single row selection
    • 1: Multiple row selection
    • 2: Single cell selection
    • 3: Multiple cell selection
    • 4: Nominated(First) single column selection
    • 5: Nominated(First) multiple column selection
    • 6: Single column selection
    • 7: Multiple column selection
    • 8: Nominated(First) single row selection
    • 9: Nominated(First) multiple row selection

Returns

Returns true if the selection mode was successfully set, false otherwise.

  • bool: result

Code Examples

client

This example creates a grid list with 10 rows. The player can use the command setMode # to change how the grid list can be selected.

local list = guiCreateGridList(0.35, 0.35, 0.4, 0.1, true)
guiGridListAddColumn(list, "Column A")
for i = 1,10 do
guiGridListAddRow(list, "Item "..tostring(i))
end
addCommandHandler('setMode', function(cmd, mode)
if (not tonumber(mode)) then
outputChatBox("Use /setMode <mode>")
return
end
guiGridListSetSelectionMode(list, tonumber(mode))
outputChatBox("Selection mode changed to "..mode)
end)

See Also

GUI Functions