GUI Classes/Button:ColorOnHover
From Multi Theft Auto: Wiki
This method allows you to set/get a color of label on the button when you hover over it.
Syntax
bool Button:ColorOnHover ( string hex )
string Button:ColorOnHover ( )
Required Arguments
- hex: hexadecimal string of the new color (format is "RRGGBBAA", red, green, blue, alpha)
Returns
- true if color was changed successfully (used "set")
- string of color (used "get")
- false otherwise.
Example
This example creates an edit box alongside an "Output!" button. When the button is clicked, it will output the message in the text box into the Chat Box.
Color of the label on button will change.
addEventHandler ( "onClientResourceStart", getResourceRootElement(), function( ) --create a button object local button = Button:Create( 0.7, 0.1, 0.2, 0.1, "Output!", true ); -- change the color when cursor is moved on top of the button button:ColorOnHover( "FF0000FF" ); --Create a TextBox (formally edit box) textBox = TextBox:Create( 0.3, 0.1, 0.4, 0.1, "Type your message here!", true ) textBox:MaxLength( 128 ) --the max chatbox length is 128, so force this -- and attach the outputTextBox function to the button button:AddOnClick( outputTextBox ); end ) --setup our function to output the message to the chatbox function outputTextBox( ) local text = textBox:Text( ) --get the text from the TextBox outputChatBox ( text ) --output that text end
See Also
Button class
Check Box class
Gridlist class
- GridList:Create
- GridList:AutoSizeColumn
- GridList:AddColumn
- GridList:AddRow
- GridList:Clear
- GridList:ItemData
- GridList:ItemText
- GridList:SelectedItem
- GridList:SortingEnabled
- GridList:RowCount
- GridList:ColumnCount
- GridList:InsertRowAfter
- GridList:RemoveColumn
- GridList:RemoveRow
- GridList:ScrollBars
- GridList:SelectionMode
Label class
- Label:Create
- Label:Color
- Label:VerticalAlign
- Label:HorizontalAlign
- Label:GetTextExtent
- Label:GetFontHeight
Memo class
Progress Bar class
- ProgressBar:Create
- ProgressBar:Font
- ProgressBar:LabelColor
- ProgressBar:Progress
- ProgressBar:Text
- ProgressBar:Size
Radio Button class
Scroll Bar class
Static Image class
Tab class
Tab panel class
Text Box class (formally known as Edit)
Window class
- GUISharedFuncs:Alpha
- GUISharedFuncs:BringToFront
- GUISharedFuncs:Dragable
- GUISharedFuncs:Enabled
- GUISharedFuncs:Font
- GUISharedFuncs:MoveToBack
- GUISharedFuncs:Property
- GUISharedFuncs:Text
- GUISharedFuncs:Position
- GUISharedFuncs:Size
- GUISharedFuncs:Visible
- GUISharedFuncs:AddOnClick
- GUISharedFuncs:RemoveOnClick
- GUISharedFuncs:AddOnMouseEnter
- GUISharedFuncs:RemoveOnMouseEnter
- GUISharedFuncs:AddOnMouseLeave
- GUISharedFuncs:RemoveOnMouseLeave