Garry's Mod Wiki

DDrawer

Description

A simple Derma Drawer

View source

Parent

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

Methods

DDrawer:Close()
Closes the DDrawer.
An AccessorFunc that returns the Open Size of DDrawer.
An AccessorFunc that returns the Open Time of DDrawer.
DDrawer:Open()
Opens the DDrawer.
DDrawer:SetOpenSize( number Value )
An AccessorFunc that sets the height of DDrawer
DDrawer:SetOpenTime( number value )
An AccessorFunc that sets the time (in seconds) for DDrawer to open.
DDrawer:Toggle()
Toggles the DDrawer.

Example

Creates a DDrawer in a DFrame; set the open size and time; add a panel in the drawer; open the DDrawer.

local Frame = vgui.Create( "DFrame" ) Frame:SetSize( 400, 200 ) Frame:Center() Frame:MakePopup() local Drawer = vgui.Create( "DDrawer", Frame ) Drawer:SetOpenSize( 75 ) -- Default OpenSize is 100 Drawer:SetOpenTime( 0.2 ) -- Default OpenTime is 0.3 Drawer:Open() -- You can also use Drawer:Close() and Drawer:Toggle() //Let's add a panel, because Drawer is empty local PanelInDrawer = vgui.Create( "DPanel", Drawer ) PanelInDrawer:Dock( FILL ) -- Make PanelInDrawer fill place of Drawer PanelInDrawer:DockMargin( 3, 0, 3, 3 ) -- Margins for the dock. Search on wiki for more info