Garry's Mod Wiki

DHorizontalScroller

Description

A very basic horizontal scrollable panel, similar to DScrollPanel.

Used internally in DPropertySheet.

Parent

Derives from Panel.

Methods

DHorizontalScroller:AddPanel( Panel pnl )
Adds a panel to the DHorizontalScroller.
Panel DHorizontalScroller:GetCanvas()
Returns the internal canvas panel where the content of DHorizontalScroller are placed on.
number DHorizontalScroller:GetOverlap()
No Description
boolean DHorizontalScroller:GetShowDropTargets()
No Description
DHorizontalScroller:MakeDroppable( string name )
Same as DDragBase:MakeDroppable. TODO: Transclude or whatever to here?
DHorizontalScroller:OnDragModified()
Called when the panel is scrolled.
DHorizontalScroller:ScrollToChild( Panel target )
Scrolls the DHorizontalScroller to given child panel.
DHorizontalScroller:SetOverlap( number overlap )
Controls the spacing between elements of the horizontal scroller.
DHorizontalScroller:SetScroll( number scroll )
Sets the scroll amount, automatically clamping the value.
DHorizontalScroller:SetShowDropTargets( boolean newState )
No Description
DHorizontalScroller:SetUseLiveDrag( boolean newState )
Same as DDragBase:SetUseLiveDrag

Example

Creates a DHorizontalScroller with a bunch of DImages attached to it.

local DFrame = vgui.Create( "DFrame" ) DFrame:SetTitle( "DHorizontalScroller Example" ) DFrame:SetSize( 500, 100 ) DFrame:Center() DFrame:MakePopup() local DHorizontalScroller = vgui.Create( "DHorizontalScroller", DFrame ) DHorizontalScroller:Dock( FILL ) DHorizontalScroller:SetOverlap( -4 ) for i = 0, 16 do local DImage = vgui.Create( "DImage", DHorizontalScroller ) DImage:SetImage( "scripted/breen_fakemonitor_1" ) DHorizontalScroller:AddPanel( DImage ) end

Example

Creates a DHorizontalScroller with a bunch of DImages attached to it and demonstrates how to color the left/right scroll buttons.

local DFrame = vgui.Create( "DFrame" ) DFrame:SetSize( 500, 100 ) DFrame:Center() DFrame:MakePopup() DFrame:SetTitle( "DHorizontalScroller Example" ) function DFrame:Paint( w, h ) draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 100, 100 ) ) end local DHorizontalScroller = vgui.Create( "DHorizontalScroller", DFrame ) DHorizontalScroller:Dock( FILL ) DHorizontalScroller:SetOverlap( -4 ) function DHorizontalScroller.btnLeft:Paint( w, h ) draw.RoundedBox( 0, 0, 0, w, h, Color( 200, 100, 0 ) ) end function DHorizontalScroller.btnRight:Paint( w, h ) draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 100, 200 ) ) end for i = 0, 16 do local DImage = vgui.Create( "DImage", DHorizontalScroller ) DImage:SetImage( "scripted/breen_fakemonitor_1" ) DHorizontalScroller:AddPanel( DImage ) end

Page Links


Special Pages


Wikis

?

Render Time: 89ms

DB GetPage 36
Generate Html 14
SaveChanges (1) 18
Render Body 0
Render Sidebar 17