Garry's Mod Wiki

DLabelURL

Description

Underlined link label without a DoClick function. When a valid URL is set and the label is clicked, it will open a browser window and navigate to the address.

This panel uses gui.OpenURL internally and its restrictions apply.

View source

Parent

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

Implements

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

Methods

We advise against using this. It may be changed or removed in a future update. Does absolutely nothing at all.
table DLabelURL:GetColor()
Gets the current text color of the DLabelURL. Returns either DLabelURL:GetTextColor or if that is unset - DLabelURL:GetTextStyleColor.
table DLabelURL:GetTextColor()
Gets the current text color of the DLabelURL set by DLabelURL:SetTextColor.
Returns the color set by DLabelURL:SetTextStyleColor.
DLabelURL:SetAutoStretchVertical( boolean draw )
We advise against using this. It may be changed or removed in a future update. Does absolutely nothing at all.
DLabelURL:SetColor( table col )
Alias of DLabelURL:SetTextColor.
DLabelURL:SetTextColor( table col )
Sets the text color of the DLabelURL. Overrides DLabelURL:SetTextStyleColor. This should only be used immediately after it is created, and otherwise Panel:SetFGColor.
DLabelURL:SetTextStyleColor( table color )
Sets the base text color of the DLabelURL. This is overridden by DLabelURL:SetTextColor.
DLabelURL:UpdateFGColor()
This is used internally - although you're able to use it you probably shouldn't. Used internally to set correct text color via Panel:SetFGColor and DLabelURL:GetColor.

Example

Creates a DLabelURL that opens the wiki when clicked.

local frame = vgui.Create( "DFrame" ) frame:SetSize( 400, 400 ) frame:SetTitle( "Test panel" ) frame:Center() frame:MakePopup() local lbl = vgui.Create( "DLabelURL", frame ) lbl:SetPos( 50, 50 ) lbl:SetSize( 100, 50 ) lbl:SetColor( Color( 255, 255, 255, 255 ) ) lbl:SetText( "I Love Gmod" ) lbl:SetURL( "http://steamcommunity.com/groups/glua" )
Output: