GuiSetProperty: Difference between revisions
Jump to navigation
Jump to search
(OOP syntax) |
(Replace to predefined variables.) |
||
(One intermediate revision by one other user not shown) | |||
Line 24: | Line 24: | ||
button = guiCreateButton( 20, 200, 150, 30, "Test", false ) | button = guiCreateButton( 20, 200, 150, 30, "Test", false ) | ||
end | end | ||
addEventHandler( "onClientResourceStart", | addEventHandler( "onClientResourceStart", resourceRoot, onStart ) | ||
function toogleButton() | function toogleButton() | ||
Line 43: | Line 43: | ||
guiSetProperty (button, "HoverTextColour", "FFFFFF00") | guiSetProperty (button, "HoverTextColour", "FFFFFF00") | ||
end | end | ||
addEventHandler ("onClientResourceStart", | addEventHandler ("onClientResourceStart", resourceRoot, onStart) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{GUI functions}} | {{GUI functions}} | ||
{{GUI_events}} |
Latest revision as of 23:13, 11 January 2023
This function sets the value of a specific CEGUI property of a GUI element. For a list of properties and their meaning, see the CEGUI properties page.
Syntax
bool guiSetProperty ( element guiElement, string property, string value )
OOP Syntax Help! I don't understand this!
- Method: GuiElement:setProperty(...)
- Counterpart: guiGetProperty
Required Arguments
- guiElement: the GUI element you wish to get a property of.
- property: the name of of property you want the value of.
- value: the new value for the property.
Returns
If the function succeeds it returns true, if it fails it returns false.
Examples
This example creates a button when the resource starts and defines a console command that toggles it between enabled (clickable) and disabled (not clickable).
function onStart() button = guiCreateButton( 20, 200, 150, 30, "Test", false ) end addEventHandler( "onClientResourceStart", resourceRoot, onStart ) function toogleButton() local currentState = guiGetProperty( button, "Disabled" ) if currentState == "False" then guiSetProperty( button, "Disabled", "True" ) else guiSetProperty( button, "Disabled", "False" ) end end addCommandHandler( "togglebtn", toogleButton )
This example creates a button when the resource starts and defines its normal color to red and hover color to yellow.
function onStart() button = guiCreateButton (20, 200, 150, 30, "Test", false) guiSetProperty (button, "NormalTextColour", "FFFF0000") -- Color format: AARRGGBB guiSetProperty (button, "HoverTextColour", "FFFFFF00") end addEventHandler ("onClientResourceStart", resourceRoot, onStart)
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
Windows
Input
GUI
- onClientGUIAccepted
- onClientGUIBlur
- onClientGUIChanged
- onClientGUIClick
- onClientGUIComboBoxAccepted
- onClientGUIDoubleClick
- onClientGUIFocus
- onClientGUIMouseDown
- onClientGUIMouseUp
- onClientGUIMove
- onClientGUIScroll
- onClientGUISize
- onClientGUITabSwitched
- onClientMouseEnter
- onClientMouseLeave
- onClientMouseMove
- onClientMouseWheel