guiGridListGetSelectionMode | Multi Theft Auto: Wiki Skip to content

guiGridListGetSelectionMode

Client-side
Server-side
Shared

Pair: guiGridListSetSelectionMode

This function retrieves the current selection mode of a gui gridlist.

OOP Syntax Help! I don't understand this!

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

Syntax

int|false guiGridListGetSelectionMode ( ​gui-gridlist gridlist )
Required arguments
  • gridlist: The gridlist you want to get the selection mode of.

Returns

Returns the ID of the current gridlist's selection mode. Returns nil if invalid gridlist argument was passed.

  • int|false: selection mode
    • 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

Code Examples

client

This example creates a grid list and adds the command getmode which will show the gridlist selection mode.

local list = guiCreateGridList(0.35, 0.35, 0.4, 0.1, true)
guiGridListAddColumn(list, "Column", 0.5)
for i = 1,10 do
local r = guiGridListAddRow(list)
guiGridListSetItemText(list, r, 1, "Item "..tostring(i))
end
-- adds the command 'getmode' which will call the function 'getSelectionMode' when typed
function getSelectionMode(commandName)
local mode = guiGridListGetSelectionMode(list) -- get the selection mode from 'myGridList'
outputChatBox("The current gridlist selection mode is " .. tostring(mode), 230, 230, 230) -- shows in the chatbox the selection mode
end
addCommandHandler("getmode", getSelectionMode)

See Also

GUI Functions