DgsLabelGetColor: Difference between revisions
Jump to navigation
Jump to search
Line 20: | Line 20: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua">local pLabel = | <syntaxhighlight lang="lua"> | ||
DGS = exports.dgs | |||
local pLabel = DGS:dgsDxCreateLabel( 0.5, 0.5, 0.5, 0.5, 'Text', true ) | |||
DGS:dgsDxLabelSetColor( pLabel, math.random( 0, 255 ), math.random( 0, 255 ), math.random( 0, 255 ), 255 ) | |||
addCommandHandler( 'get_color_label', | addCommandHandler( 'get_color_label', | ||
function() | function(cmd,notSplit) | ||
local iR, iG, iB = | notSplit = notSplit and true or false | ||
if notSplit then | |||
local color = DGS:dgsDxLabelGetColor( pLabel, true ) | |||
outputChatBox( 'Label color is '..color ) | |||
else | |||
local iR, iG, iB = DGS:dgsDxLabelGetColor( pLabel ) | |||
outputChatBox( ( 'Label color is r = %d, g = %d, b = %d' ):format( iR, iG, iB ) ) | |||
end | |||
end | end | ||
)</syntaxhighlight> | )</syntaxhighlight> |
Revision as of 15:41, 12 June 2017
This function gets the color of a label.
Syntax
int int int dgsDxLabelGetColor ( dgs-element theLabel [, bool notSplit = false ] )
Required Arguments
- theLabel: The label to get color.
- notSplit: A bool of whether the color is split into r,g,b,a or not.
Returns
If argument 'notSplit' passed true, returns one int value, representing the color of the label if successful. false otherwise.
If argument 'notSplit' passed false, returns three int values, representing the amount of red, green, blue if successful. false otherwise.
Example
DGS = exports.dgs local pLabel = DGS:dgsDxCreateLabel( 0.5, 0.5, 0.5, 0.5, 'Text', true ) DGS:dgsDxLabelSetColor( pLabel, math.random( 0, 255 ), math.random( 0, 255 ), math.random( 0, 255 ), 255 ) addCommandHandler( 'get_color_label', function(cmd,notSplit) notSplit = notSplit and true or false if notSplit then local color = DGS:dgsDxLabelGetColor( pLabel, true ) outputChatBox( 'Label color is '..color ) else local iR, iG, iB = DGS:dgsDxLabelGetColor( pLabel ) outputChatBox( ( 'Label color is r = %d, g = %d, b = %d' ):format( iR, iG, iB ) ) end end )
See Also
General functions
- guiBringToFront
- getChatboxLayout
- getChatboxCharacterLimit
- guiCreateFont
- guiBlur
- guiFocus
- guiGetAlpha
- guiGetCursorType
- guiGetEnabled
- guiGetFont
- guiGetInputEnabled
- guiGetInputMode
- guiGetPosition
- guiGetProperties
- guiGetProperty
- guiGetScreenSize
- guiGetSize
- guiGetText
- guiGetVisible
- guiMoveToBack
- guiSetAlpha
- guiSetEnabled
- guiSetFont
- guiSetInputEnabled
- guiSetInputMode
- guiSetPosition
- guiSetProperty
- guiSetSize
- guiSetText
- guiSetVisible
- isChatBoxInputActive
- isConsoleActive
- isDebugViewActive
- isMainMenuActive
- isMTAWindowActive
- isTransferBoxActive
- setChatboxCharacterLimit
- setDebugViewActive
Browsers
Buttons
Checkboxes
Comboboxes
- guiCreateComboBox
- guiComboBoxAddItem
- guiComboBoxClear
- guiComboBoxGetItemCount
- guiComboBoxGetItemText
- guiComboBoxGetSelected
- guiComboBoxIsOpen
- guiComboBoxRemoveItem
- guiComboBoxSetItemText
- guiComboBoxSetOpen
- guiComboBoxSetSelected
Edit Boxes
- guiCreateEdit
- guiEditGetCaretIndex
- guiEditGetMaxLength
- guiEditIsMasked
- guiEditIsReadOnly
- guiEditSetCaretIndex
- guiEditSetMasked
- guiEditSetMaxLength
- guiEditSetReadOnly
Gridlists
- guiCreateGridList
- guiGridListAddColumn
- guiGridListAddRow
- guiGridListAutoSizeColumn
- guiGridListClear
- guiGridListGetColumnCount
- guiGridListGetColumnTitle
- guiGridListGetColumnWidth
- guiGridListGetHorizontalScrollPosition
- guiGridListGetItemColor
- guiGridListGetItemData
- guiGridListGetItemText
- guiGridListGetRowCount
- guiGridListGetSelectedCount
- guiGridListGetSelectedItem
- guiGridListGetSelectedItems
- guiGridListGetSelectionMode
- guiGridListIsSortingEnabled
- guiGridListGetVerticalScrollPosition
- guiGridListInsertRowAfter
- guiGridListRemoveColumn
- guiGridListRemoveRow
- guiGridListSetColumnTitle
- guiGridListSetColumnWidth
- guiGridListSetHorizontalScrollPosition
- guiGridListSetItemColor
- guiGridListSetItemData
- guiGridListSetItemText
- guiGridListSetScrollBars
- guiGridListSetSelectedItem
- guiGridListSetSelectionMode
- guiGridListSetSortingEnabled
- guiGridListSetVerticalScrollPosition
Memos
- guiCreateMemo
- guiMemoGetCaretIndex
- guiMemoGetVerticalScrollPosition
- guiMemoSetVerticalScrollPosition
- guiMemoIsReadOnly
- guiMemoSetCaretIndex
- guiMemoSetReadOnly
Progressbars
Radio Buttons
Scrollbars
Scrollpanes
- guiCreateScrollPane
- guiScrollPaneGetHorizontalScrollPosition
- guiScrollPaneGetVerticalScrollPosition
- guiScrollPaneSetHorizontalScrollPosition
- guiScrollPaneSetScrollBars
- guiScrollPaneSetVerticalScrollPosition
Static Images
Tab Panels
Tabs
Text Labels
- guiCreateLabel
- guiLabelGetColor
- guiLabelGetFontHeight
- guiLabelGetTextExtent
- guiLabelSetColor
- guiLabelSetHorizontalAlign
- guiLabelSetVerticalAlign