From GMod Wiki
Derma Control: DHorizontalScroller |
Parent Class: | Panel |
Subclasses: | |
Description: |
Creates a scrolling list of panels. |
Examples
Description | Create a scroller with 20 buttons. |
Used on | |
Code |
concommand.Add("ScrollerMenu", function(ply, cmd, args)
local Frame = vgui.Create("DFrame")
Frame:SetSize(200,70)
Frame:Center()
local Scroller = vgui.Create("DHorizontalScroller", Frame) --Create the scroller
Scroller:SetSize(Frame:GetWide()-8, 40)
Scroller:AlignBottom(4)
Scroller:AlignLeft(4)
Scroller:SetOverlap(-4) --Set how much to overlap, negative numbers will space out the panels.
local Buttons = {}
for i=1, 20 do --Create 20 buttons
Buttons[i] = vgui.Create("DButton", Scroller) --Create the button
Buttons[i]:SetSize(40, 40)
Buttons[i]:SetText("Butt "..i)
Scroller:AddPanel(Buttons[i]) --Add each button to our Scroller after we create it.
end
end)
|
Output | |
Methods
DHorizontalScroller.AddPanel
DHorizontalScroller.GetOverlap
DHorizontalScroller.Init
DHorizontalScroller.OnMouseWheeled
DHorizontalScroller.PerformLayout
DHorizontalScroller.SetOverlap
DHorizontalScroller.Think