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.

Methods

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

Example

Creates a DAlphaBar and sets its value to 25%.

local DAlphaBar = vgui.Create( "DAlphaBar" ) DAlphaBar:SetPos( 20, 30 ) DAlphaBar:SetSize( 25, 125 ) DAlphaBar:SetValue( 0.25 ) DAlphaBar.OnChange = function( self, newvalue ) print( "DAlphaBar value changed to " .. newvalue ) end