Garry's Mod Wiki

DPanPanel

Description

A panel similar to DScrollPanel, but that allows the player to pan around, for example a zoomed in image within a small window.

View source

Parent

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

Implements

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

Methods

DPanPanel:AddItem( Panel pnl )
Parents the passed panel to the DPanPanel:GetCanvas.
Panel DPanPanel:GetCanvas()
The internal canvas panel.
DPanPanel:OnScroll( number x, number y )
This is used internally - although you're able to use it you probably shouldn't. Used internally, called from DPanPanel:ScrollToChild.
DPanPanel:ScrollToChild( Panel pnl )
Scroll to a specific child panel.
DPanPanel:SetCanvas( Panel pnl )
This is used internally - although you're able to use it you probably shouldn't. Used internally.

Examples

Example

local dpan = vgui.Create( "DFrame" ) dpan:SetSize( 700, 500 ) dpan:Center() dpan:MakePopup() local dpl = vgui.Create( "DPanel", dpan ) dpl:SetSize( 200, 200 ) dpl:SetPos( 100, 100 ) local panl = vgui.Create( "DPanPanel", dpl ) panl:Dock( FILL ) local bl1 = panl:Add( "DButton" ) bl1:SetText( "Small" ) local bl2 = panl:Add( "DButton" ) bl2:SetPos( 100, 100 ) bl2:SetText( "Contents" ) local dpr = vgui.Create( "DPanel", dpan ) dpr:SetSize( 200, 200 ) dpr:SetPos( 310, 100 ) local panr = vgui.Create( "DPanPanel", dpr ) panr:Dock( FILL ) local br1 = panr:Add( "DButton" ) br1:SetText( "Big" ) local br2 = panr:Add( "DButton" ) br2:SetPos( 300, 300 ) br2:SetText( "Contents" )
Output: