Category:DNotify

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(f)
m (local var)
 
Line 3: Line 3:
 
|Preview=DNotify.gif
 
|Preview=DNotify.gif
 
|Description=A panel that fades its contents in and out once, like a notification.
 
|Description=A panel that fades its contents in and out once, like a notification.
 +
|Hooks=
 
}}
 
}}
 
{{Example
 
{{Example
 
|Description=Creates a notification panel with a text label inside.
 
|Description=Creates a notification panel with a text label inside.
 
|Code=--Notification panel
 
|Code=--Notification panel
NotifyPanel = vgui.Create("DNotify")
+
local NotifyPanel = vgui.Create("DNotify")
 
NotifyPanel:SetPos(10, 5)
 
NotifyPanel:SetPos(10, 5)
 
NotifyPanel:SetSize(200, 40)
 
NotifyPanel:SetSize(200, 40)
Line 24: Line 25:
 
|Description=Creates a notification panel of Dr. Kleiner reminding the player to wear their HEV suit.
 
|Description=Creates a notification panel of Dr. Kleiner reminding the player to wear their HEV suit.
 
|Code=-- Notification panel
 
|Code=-- Notification panel
NotifyPanel = vgui.Create("DNotify")
+
local NotifyPanel = vgui.Create("DNotify")
 
NotifyPanel:SetPos(15, 15)
 
NotifyPanel:SetPos(15, 15)
 
NotifyPanel:SetSize(150, 210)
 
NotifyPanel:SetSize(150, 210)

Latest revision as of 14:19, 5 December 2018

Contents

DescriptionPanelPage

A panel that fades its contents in and out once, like a notification.

Inherited Functions

Inherits the following functions from Panel and its parents up to 3 levels deep:


Examples

Example

Creates a notification panel with a text label inside.

--Notification panel
local NotifyPanel = vgui.Create("DNotify")
NotifyPanel:SetPos(10, 5)
NotifyPanel:SetSize(200, 40)

-- Text label
local lbl = vgui.Create("DLabel", NotifyPanel)
lbl:Dock(FILL)
lbl:SetText("This is a notification.")
lbl:SetFont("GModNotify")
lbl:SetDark(true)

-- Add the label to the notification and begin fading
NotifyPanel:AddItem(lbl)


Examples

Example

Creates a notification panel of Dr. Kleiner reminding the player to wear their HEV suit.

-- Notification panel
local NotifyPanel = vgui.Create("DNotify")
NotifyPanel:SetPos(15, 15)
NotifyPanel:SetSize(150, 210)

-- Gray background panel
local bg = vgui.Create("DPanel", NotifyPanel)
bg:Dock(FILL)
bg:SetBackgroundColor(Color(64, 64, 64))

-- Image of Dr. Kleiner (parented to background panel)
local img = vgui.Create("DImage", bg)
img:SetPos(11, 11)
img:SetSize(128, 128)
img:SetImage("entities/npc_kleiner.png")

-- A yellow label message (parented to background panel)
local lbl = vgui.Create("DLabel", bg)
lbl:SetPos(11, 136)
lbl:SetSize(128, 72)
lbl:SetText("Remember to wear your HEV suit!")
lbl:SetTextColor(Color(255, 200, 0))
lbl:SetFont("GModNotify")
lbl:SetWrap(true)

-- Add the background panel to the notification
NotifyPanel:AddItem(bg)

Output:

DNotify example2.gif

Pages in category "DNotify"

The following 9 pages are in this category, out of 9 total.

Personal tools
Navigation