Garry's Mod Wiki

Revision Difference

DDrawer#513357

<panel>⤶ <name>DDrawer</name>⤶ <parent>Panel</parent>⤶ <preview>DDrawer_ex1.png</preview>⤶ <description>A simple Derma Drawer</description>⤶ ⤶ </panel>⤶ ⤶ ⤶ <example>⤶ <description>Creates a DDrawer in a DFrame; set the open size and time; add a panel in the drawer; open the DDrawer.</description>⤶ <code>⤶ 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⤶ </code>⤶ ⤶ </example>⤶ ⤶