DHorizontalScroller

From GMod Wiki

Revision as of 20:11, 26 December 2009 by CowThing (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Derma Control: DHorizontalScroller
Parent Class:Panel
Subclasses:
Description:
Creates a scrolling list of panels.

Examples

DescriptionCreate a scroller with 20 buttons.
Used onNewerClient.png
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)
 
Output1zekz10.png

Methods

NewerClient.png DHorizontalScroller.AddPanel
NewerClient.png DHorizontalScroller.GetOverlap
NewerClient.png DHorizontalScroller.Init
NewerClient.png DHorizontalScroller.OnMouseWheeled
NewerClient.png DHorizontalScroller.PerformLayout
NewerClient.png DHorizontalScroller.SetOverlap
NewerClient.png DHorizontalScroller.Think

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox