Garry's Mod Wiki

DAlphaBar

Description

A bar to select the opacity (alpha level) of a color.

View source

Parent

Derives methods, etc not listed on this page from DPanel.

Implements

Implements or overrides the following hooks/methods. If you want to override these, you probably want to call the original function too.

Events

DAlphaBar:OnChange( number alpha )
Called when user changes the desired alpha value with the control. This function is meant to be overridden

Methods

table DAlphaBar:GetBarColor()
Returns the base color of the alpha bar. This is the color for which the alpha channel is being modified. An AccessorFunc
number DAlphaBar:GetValue()
Returns the alpha value of the alpha bar. An AccessorFunc
DAlphaBar:SetBarColor( table clr )
Sets the base color of the alpha bar. This is the color for which the alpha channel is being modified. An AccessorFunc
DAlphaBar:SetValue( number alpha )
Sets the alpha value or the alpha bar. An AccessorFunc

Example

Creates a DAlphaBar on a DFrame sets its value to 25%.

local frame = vgui.Create( "DFrame" ) frame:SetSize( 300, 500 ) frame:Center() frame:MakePopup() local DAlphaBar = vgui.Create( "DAlphaBar", frame ) DAlphaBar:SetPos( 20, 30 ) DAlphaBar:SetSize( 25, 125 ) DAlphaBar:SetValue( 0.25 ) DAlphaBar.OnChange = function( self, newvalue ) print( "DAlphaBar value changed to " .. newvalue ) end frame:MakePopup()
gmod_T1YSxbrW8Y.gif