DButton.GetSelected

From GMod Wiki

Jump to: navigation, search
Function
Syntax DButton.GetSelected( )
Where is this used?
Description:
Gets whether or not the button is constantly selected.
Returns: Boolean selected
Part of Library: DButton
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=DButton.GetSelected]DButton.GetSelected [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionCreates a toggle button that prints whether it was selected or deselected.
Used onNewerClient.png
Code
//Code creating a DFrame
 
local button = vgui.Create("DButton", SomeParent)
button.DoClick = function(self)
    if self:GetSelected() then
       self:SetSelected(false)
       print("Deselected")
    else
       self:SetSelected(true)
       print("Selected")
    end
end
OutputA button that can be turned on/off, and will print its state each time it's clicked.


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox