Garry's Mod Wiki

DHScrollBar

Description

A generic horizontal scrollbar. See the vertical alternative here.

The scrollbar notably contains DHScrollBar.btnLeft, DHScrollBar.btnRight, and DHScrollBar.btnGrip which are the left button, right button, and grip respectively. Editing the paint functions of these allows custom scrollbar styling, 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 DHScrollBar:AddScroll( number add )
Adds specified amount of scroll in pixels.
DHScrollBar:AnimateTo( number scroll, number length, number delay = 0, number ease = -1 )
Smoothly scrolls to given level.
number DHScrollBar: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 DHScrollBar:SetUp.
boolean DHScrollBar:GetHideButtons()
Returns whether or not the manual left/right scroll buttons are visible or not. Set by DHScrollBar:SetHideButtons.
number DHScrollBar:GetOffset()
Returns the negative of DHScrollBar:GetScroll.
number DHScrollBar:GetScroll()
Returns the amount of scroll level from the left in pixels.
DHScrollBar:Grip()
This is used internally - although you're able to use it you probably shouldn't. Called from within DScrollBarGrip
DHScrollBar:SetHideButtons( boolean hide )
Allows hiding the left and right buttons for better visual stylisation.
DHScrollBar:SetScroll( number scroll )
Sets the scroll level in pixels.
DHScrollBar:SetUp( number barSize, number canvasSize )
Sets up the scrollbar for use. The scrollbar will automatically disable itself if the total width of the canvas is lower than the width of the panel that holds the canvas during this function call.