Garry's Mod Wiki

DVScrollBar

Description

A generic vertical scrollbar, used in DScrollPanel. See the horizontal alternative here.

The scrollbar notably contains DVScrollBar.btnUp, DVScrollBar.btnDown, and DVScrollBar.btnGrip which are the up button, down button, and grip respectively. Editing the paint functions of these allows custom scrollbar styling (See DScrollPanel:GetVBar for an example), although it is a better idea to use Derma Skins.

View source

Parent

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

Methods

boolean DVScrollBar:AddScroll( number add )
Adds specified amount of scroll in pixels.
DVScrollBar:AnimateTo( number scroll, number length, number delay = 0, number ease = -1 )
Smoothly scrolls to given level.
number DVScrollBar:BarScale()
Returns the scale of the scroll bar based on the difference in size between the visible "window" into the canvas that is being scrolled. Should be used after DVScrollBar:SetUp.
boolean DVScrollBar:GetHideButtons()
Returns whether or not the manual up/down scroll buttons are visible or not. Set by DVScrollBar:SetHideButtons.
number DVScrollBar:GetOffset()
Returns the negative of DVScrollBar:GetScroll.
number DVScrollBar:GetScroll()
Returns the amount of scroll level from the top in pixels
DVScrollBar:Grip()
This is used internally - although you're able to use it you probably shouldn't. Called from within DScrollBarGrip
DVScrollBar:SetHideButtons( boolean hide )
Allows hiding the up and down buttons for better visual stylisation.
DVScrollBar:SetScroll( number scroll )
Sets the scroll level in pixels.
DVScrollBar:SetUp( number barSize, number canvasSize )
Sets up the scrollbar for use. The scrollbar will automatically disable itself if the total height of the canvas is lower than the height of the panel that holds the canvas during this function call.