Category:DScrollPanel

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Add an actually working example, showing off the scrollbar)
Line 5: Line 5:
 
This can be used to replace the {{Type|DPanelList}} with {{ClassFunction|DPanelList|EnableVerticalScrollbar}} and get similar functionality as well as using a non-deprecated element.
 
This can be used to replace the {{Type|DPanelList}} with {{ClassFunction|DPanelList|EnableVerticalScrollbar}} and get similar functionality as well as using a non-deprecated element.
  
If you would like to paint or edit the elements of the scrollbar use {{VGUIElementMethodInternal|GetVBar}}. See an example on the {{Type|DVScrollBar}} page.
+
If you would like to paint or edit the elements of the scrollbar use {{VGUIElementMethodInternal|GetVBar}}.
  
 
{{Note|{{ClassFunction|Panel|DockPadding}} will not have an effect on children of this panel. Use the function on {{ClassFunction|DScrollPanel|GetCanvas}} instead.}}
 
{{Note|{{ClassFunction|Panel|DockPadding}} will not have an effect on children of this panel. Use the function on {{ClassFunction|DScrollPanel|GetCanvas}} instead.}}

Revision as of 09:46, 10 November 2017

Contents

DescriptionPanelPage

DScrollPanel is a VGUI Element similar to DPanel however it has a vertical scrollbar docked to the right which can be used to put more content in a smaller area. DScrollPanels are essentially DPanels with the Scroll Bar.

This can be used to replace the DPanelList with DPanelList:EnableVerticalScrollbar and get similar functionality as well as using a non-deprecated element.

If you would like to paint or edit the elements of the scrollbar use GetVBar.

NOTE

Panel:DockPadding will not have an effect on children of this panel. Use the function on DScrollPanel:GetCanvas instead.

Inherited Functions

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


Examples

Example

Creates a DScrollPanel and adds 100 DButtons to it.

local frame = vgui.Create( "DFrame" )
frame:SetSize( 500, 500 )
frame:Center()
frame:MakePopup()

local DScrollPanel = vgui.Create( "DScrollPanel", frame )
DScrollPanel:Dock( FILL )

for i=0, 100 do
	local DLabel = DScrollPanel:Add( "DButton" )
	DLabel:SetText( "Button #" .. i )
	DLabel:Dock( TOP )
	DLabel:DockMargin( 0, 0, 0, 5 )
end


Personal tools
Navigation