Garry's Mod Wiki

DLabel

Description

A standard Derma text label. A lot of this panels functionality is a base for button elements, such as DButton

Parent

Derives from Label.

Methods

DLabel:DoClick()
Called when the label is left clicked (on key release) by the player. This will be called after DLabel:OnDepressed and DLabel:OnReleased. This can be overridden; by default, it calls DLabel:Toggle. See also DLabel:DoRightClick, DLabel:DoMiddleClick and DLabel:DoDoubleClick.
DLabel:DoClickInternal()
Called just before DLabel:DoClick. In DLabel does nothing and is safe to override. Used by DMenuOption and DCollapsibleCategory's tabs.
DLabel:DoDoubleClick()
Called when the label is double clicked by the player with left clicks. DLabel:SetDoubleClickingEnabled must be set to true for this hook to work, which it is by default. This will be called after DLabel:OnDepressed and DLabel:OnReleased and DLabel:DoClick. See also DLabel:DoRightClick and DLabel:DoMiddleClick.
DLabel:DoDoubleClickInternal()
Called just before DLabel:DoDoubleClick. In DLabel does nothing and is safe to override.
DLabel:DoMiddleClick()
Called when the label is middle mouse (Mouse wheel, also known as mouse 3) clicked (on key release) by the player. This will be called after DLabel:OnDepressed and DLabel:OnReleased. See also DLabel:DoClick, DLabel:DoRightClick and DLabel:DoDoubleClick.
DLabel:DoRightClick()
Called when the label is right clicked (on key release) by the player. This will be called after DLabel:OnDepressed and DLabel:OnReleased. See also DLabel:DoClick, DLabel:DoMiddleClick and DLabel:DoDoubleClick.
boolean DLabel:GetAutoStretchVertical()
Returns whether the label stretches vertically or not. Set by DLabel:SetAutoStretchVertical.
boolean DLabel:GetBright()
Returns whether the DLabel should set its text color to the current skin's bright text color. See DLabel:SetBright.
table DLabel:GetColor()
Returns the actual color of the text. See also DLabel:GetTextColor and DLabel:GetTextStyleColor.
boolean DLabel:GetDark()
Returns whether the DLabel should set its text color to the current skin's dark text color. See DLabel:SetDark.
boolean DLabel:GetDisabled()
We advise against using this. It may be changed or removed in a future update. Use Panel:IsEnabled instead. Gets the disabled state of the DLabel. This is set with DLabel:SetDisabled.
boolean DLabel:GetDoubleClickingEnabled()
Returns whether or not double clicking will call DLabel:DoDoubleClick. See DLabel:SetDoubleClickingEnabled.
string DLabel:GetFont()
Returns the current font of the DLabel. This is set with DLabel:SetFont.
boolean DLabel:GetHighlight()
Returns whether the DLabel should set its text color to the current skin's highlighted text color. See DLabel:SetHighlight.
boolean DLabel:GetIsToggle()
Returns whether the toggle functionality is enabled for a label. Set with DLabel:SetIsToggle.
table DLabel:GetTextColor()
Returns the "override" text color, set by DLabel:SetTextColor.
table DLabel:GetTextStyleColor()
This is used internally - although you're able to use it you probably shouldn't. Returns the "internal" or fallback color of the text. See also DLabel:GetTextColor and DLabel:SetTextStyleColor.
boolean DLabel:GetToggle()
Returns the current toggle state of the label. This can be set with DLabel:SetToggle and toggled with DLabel:Toggle. In order to use toggle functionality, you must first call DLabel:SetIsToggle with true, as it is disabled by default.
DLabel:OnDepressed()
Called when the player presses the label with any mouse button. This works as an alternative to PANEL:OnMousePressed as that hook is used heavily by DLabel and overriding it will break functionality. See also DLabel:DoClick, DLabel:DoMiddleClick, DLabel:DoRightClick, DLabel:OnReleased and DLabel:DoDoubleClick.
DLabel:OnReleased()
Called when the player releases any mouse button on the label. This is always called after DLabel:OnDepressed. This works as an alternative to PANEL:OnMouseReleased as that hook is used heavily by DLabel and overriding it will break functionality. See also DLabel:DoClick, DLabel:DoMiddleClick, DLabel:DoRightClick and DLabel:DoDoubleClick.
DLabel:OnToggled( boolean toggleState )
Called when the toggle state of the label is changed by DLabel:Toggle. In order to use toggle functionality, you must first call DLabel:SetIsToggle with true, as it is disabled by default.
DLabel:SetAutoStretchVertical( boolean stretch )
Automatically adjusts the height of the label dependent of the height of the text inside of it.
DLabel:SetBright( boolean bright )
We advise against using this. It may be changed or removed in a future update. You really should use DLabel:SetTextColor. Sets the color of the text to the bright text color defined in the skin. See also DLabel:SetDark and DLabel:SetHighlight. You should only consider using this if you are using background elements that are not manually painted and are using the skin colors.
DLabel:SetColor( table color )
Changes color of label. Alias of DLabel:SetTextColor.
DLabel:SetDark( boolean dark )
We advise against using this. It may be changed or removed in a future update. You really should use DLabel:SetTextColor. Sets the color of the text to the dark text color defined in the skin. See also DLabel:SetBright and DLabel:SetHighlight. You should only consider using this if you are using background elements that are not manually painted and are using the skin colors.
DLabel:SetDisabled( boolean disable )
We advise against using this. It may be changed or removed in a future update. Use Panel:SetEnabled instead. Sets the disabled state of the DLabel. When disabled, the label does not respond to click, toggle or drag & drop actions.
DLabel:SetDoubleClickingEnabled( boolean enable )
Sets whether or not double clicking should call DLabel:DoDoubleClick. This is enabled by default.
DLabel:SetFont( string fontName )
Sets the font of the label.
DLabel:SetHighlight( boolean highlight )
We advise against using this. It may be changed or removed in a future update. You really should use DLabel:SetTextColor. Sets the color of the text to the highlight text color defined in the skin. For the default Derma skin this makes the label red. See also DLabel:SetBright and DLabel:SetDark. You should only consider using this if you are using background elements that are not manually painted and are using the skin colors.
DLabel:SetIsToggle( boolean allowToggle )
Enables or disables toggle functionality for a label. Retrieved with DLabel:GetIsToggle. You must call this before using DLabel:SetToggle, DLabel:GetToggle or DLabel:Toggle.
DLabel:SetTextColor( table color )
Sets the text color of the DLabel. This will take precedence over DLabel:SetTextStyleColor.
DLabel:SetTextStyleColor( table color )
This is used internally - although you're able to use it you probably shouldn't. Use DLabel:SetTextColor instead! Used by DLabel:SetDark, DLabel:SetBright and DLabel:SetHighlight to set the text color without affecting DLabel:SetTextColor calls.
DLabel:SetToggle( boolean toggleState )
Sets the toggle state of the label. This can be retrieved with DLabel:GetToggle and toggled with DLabel:Toggle. In order to use toggle functionality, you must first call DLabel:SetIsToggle with true, as it is disabled by default.
DLabel:Toggle()
Toggles the label's state. This can be set and retrieved with DLabel:SetToggle and DLabel:GetToggle. In order to use toggle functionality, you must first call DLabel:SetIsToggle with true, as it is disabled by default.
DLabel:UpdateColours( table skin )
A hook called from within DLabel:ApplySchemeSettings to determine the color of the text on display.
DLabel:UpdateFGColor()
This is used internally - although you're able to use it you probably shouldn't. Called internally to update the color of the text.

Example

Creates a DLabel.

local Panel = vgui.Create( "DFrame" ) Panel:SetSize( 200, 200 ) Panel:Center() Panel:MakePopup() local DLabel = vgui.Create( "DLabel", Panel ) DLabel:SetPos( 40, 40 ) DLabel:SetText( "Hello, world!" )
Output:

Methods

Page Links


Special Pages


Wikis

?

Render Time: 64ms

DB GetPage 8
Generate Html 20
SaveChanges (1) 18
Render Body 0
Render Sidebar 12