guiGridListGetItemColor
Client-side
Server-side
Shared
Pair: guiGridListSetItemColor
This function gets the color of a gridlist item.
OOP Syntax Help! I don't understand this!
- Method:gui-gridlist:getItemColor(...)
Syntax
int|false, int, int, int guiGridListGetItemColor ( gui-gridlist gridList, int rowIndex, int columnIndex )Required arguments
- gridList: The grid list element.
- rowIndex: Row ID. Indexes start at 0.
- columnIndex: Column ID. Indexes start at 1.
Returns
Returns four int values, representing the amount of red, green, blue and alpha if successful. false otherwise.
- int|false: r
- int: g
- int: b
- int: a
Code Examples
client
This example creates a player list on the right of the screen and fills it with players online and sets the grid list item color according to their nametag color. When the player clicks on a grid list item, it'll output the color of it.
function createPlayerList() -- Create the grid list element local playerList = guiCreateGridList(0.80, 0.10, 0.15, 0.60, true) -- Create a players column in the list addEventHandler("onClientGUIClick", playerList, onGridListClick, false) local column = guiGridListAddColumn(playerList, "Player", 0.85) if (column) then -- If the column has been created, fill it with players for id, player in ipairs(getElementsByType("player")) do local row = guiGridListAddRow(playerList) local r, g, b = getPlayerNametagColor(player) -- We get the player nametag color. guiGridListSetItemText(playerList, row, column, getPlayerName(player), false, false) guiGridListSetItemColor(playerList, row, column, r, g, b) -- We set the grid list item color to the returned values of getPlayerNametagColor. end endendaddEventHandler("onClientResourceStart", resourceRoot, createPlayerList)
function onGridListClick() local row, col = guiGridListGetSelectedItem(source) if (row and col and row ~= -1 and col ~= -1) then local r, g, b, a = guiGridListGetItemColor(source, row, col) outputChatBox("Red: " .. r, 255, 0, 0) outputChatBox("Green: " .. g, 0, 255, 0) outputChatBox("Blue: " .. b, 0, 0, 255) outputChatBox("Alpha: " .. a, 255, 255, 255) endendSee Also
GUI Functions
- getChatboxCharacterLimit
- getChatboxLayout
- guiBlur
- guiBringToFront
- guiCheckBoxGetSelected
- guiCheckBoxSetSelected
- guiComboBoxAddItem
- guiComboBoxClear
- guiComboBoxGetItemCount
- guiComboBoxGetItemText
- guiComboBoxGetSelected
- guiComboBoxIsOpen
- guiComboBoxRemoveItem
- guiComboBoxSetItemText
- guiComboBoxSetOpen
- guiComboBoxSetSelected
- guiCreateBrowser
- guiCreateButton
- guiCreateCheckBox
- guiCreateComboBox
- guiCreateEdit
- guiCreateFont
- guiCreateGridList
- guiCreateLabel
- guiCreateMemo
- guiCreateProgressBar
- guiCreateRadioButton
- guiCreateScrollBar
- guiCreateScrollPane
- guiCreateStaticImage
- guiCreateTab
- guiCreateTabPanel
- guiCreateWindow
- guiDeleteTab
- guiEditGetCaretIndex
- guiEditGetMaxLength
- guiEditIsMasked
- guiEditIsReadOnly
- guiEditSetCaretIndex
- guiEditSetMasked
- guiEditSetMaxLength
- guiEditSetReadOnly
- guiFocus
- guiGetAlpha
- guiGetBrowser
- guiGetCursorType
- guiGetEnabled
- guiGetFont
- guiGetInputEnabled
- guiGetInputMode
- guiGetPosition
- guiGetProperties
- guiGetProperty
- guiGetScreenSize
- guiGetSelectedTab
- guiGetSize
- guiGetText
- guiGetVisible
- guiGridListAddColumn
- guiGridListAddRow
- guiGridListAutoSizeColumn
- guiGridListClear
- guiGridListGetColumnCount
- guiGridListGetColumnTitle
- guiGridListGetColumnWidth
- guiGridListGetHorizontalScrollPosition
- guiGridListGetItemColor
- guiGridListGetItemData
- guiGridListGetItemText
- guiGridListGetRowCount
- guiGridListGetSelectedCount
- guiGridListGetSelectedItem
- guiGridListGetSelectedItems
- guiGridListGetSelectionMode
- guiGridListGetVerticalScrollPosition
- guiGridListInsertRowAfter
- guiGridListIsSortingEnabled
- guiGridListRemoveColumn
- guiGridListRemoveRow
- guiGridListSetColumnTitle
- guiGridListSetColumnWidth
- guiGridListSetHorizontalScrollPosition
- guiGridListSetItemColor
- guiGridListSetItemData
- guiGridListSetItemText
- guiGridListSetScrollBars
- guiGridListSetSelectedItem
- guiGridListSetSelectionMode
- guiGridListSetSortingEnabled
- guiGridListSetVerticalScrollPosition
- guiLabelGetColor
- guiLabelGetFontHeight
- guiLabelGetTextExtent
- guiLabelSetColor
- guiLabelSetHorizontalAlign
- guiLabelSetVerticalAlign
- guiMemoGetCaretIndex
- guiMemoGetVerticalScrollPosition
- guiMemoIsReadOnly
- guiMemoSetCaretIndex
- guiMemoSetReadOnly
- guiMemoSetVerticalScrollPosition
- guiMoveToBack
- guiProgressBarGetProgress
- guiProgressBarSetProgress
- guiRadioButtonGetSelected
- guiRadioButtonSetSelected
- guiScrollBarGetScrollPosition
- guiScrollBarSetScrollPosition
- guiScrollPaneGetHorizontalScrollPosition
- guiScrollPaneGetVerticalScrollPosition
- guiScrollPaneSetHorizontalScrollPosition
- guiScrollPaneSetScrollBars
- guiScrollPaneSetVerticalScrollPosition
- guiSetAlpha
- guiSetEnabled
- guiSetFont
- guiSetInputEnabled
- guiSetInputMode
- guiSetPosition
- guiSetProperty
- guiSetSelectedTab
- guiSetSize
- guiSetText
- guiSetVisible
- guiStaticImageGetNativeSize
- guiStaticImageLoadImage
- guiWindowIsMovable
- guiWindowIsSizable
- guiWindowSetMovable
- guiWindowSetSizable
- isChatBoxInputActive
- isConsoleActive
- isDebugViewActive
- isMainMenuActive
- isMTAWindowActive
- isTransferBoxActive
- setChatboxCharacterLimit
- setDebugViewActive