VGui help

Hey guys, I need help thinking how to do something that i need to do.
Currently i got a table with values, and i want to show them on a vGui i am using a thing called: “DPanelList”, but i got a problem thinking how to do something that i need.
This is a part of my vgui: http://puu.sh/8Y9Ay.jpg .
i am using a for to collect all of the tables:


for k,v in pairs (sh_gm.Jobs) do

But i’ll add 2 buttons which is “Next>”, and “<Back”, which will go to the next page, and go to the page before it.
I am actully going to show every 2 tables in thoes, and lets say the guy clicks next, it’ll show him 3,4.
Anyone got any idea on how to do it?
Thanks.

Don’t bother with pages, just make a scrollbar. It is much more user friendly. Trust me. Just add the panels into your DPanelList using DPanelList:AddItem and call DPanelList:EnableVerticalScrollbar( true ) on it.

mhm, i’ll do it at the moment, but i am looking for an answer with someone telling me how to do it :P.
and thanks ^^.

Answer me this: Why do you need pages? They are literally worse than a scrollbar: You need more code for it, it is more unnecessary clicks for the user.

Emm I am currently using

But for some reason it doesn’t except strings, and its waiting for an int, would you know why?
Never mind just found the issue, it is waiting for an item, though it is adding a label.

And to make it a bit more unique :slight_smile:

Unique isn’t always best. DPanelList:AddItem(k.name) expects a PANEL, not a string.

is this correct?:



local TextLabelsList = vgui.Create( "DPanelList", MainJobMenu3 )
				TextLabelsList:SetSize (wMod * 900, hMod * 327)
				TextLabelsList:SetPos( wMod * 30, hMod * 30)
				TextLabelsList:SetPadding( 0 )
				TextLabelsList:SetSpacing( 3 )
				TextLabelsList:SetAutoSize( false )
				TextLabelsList:SetNoSizing( false )
				TextLabelsList:EnableVerticalScrollbar( true )
				TextLabelsList.Paint = function() end
				TextLabelsList:SetVisible(true)
	local label = vgui.Create("DLabel", MainJobMenu3)
	label:SetFont("Speical font")
	label:SetPos( wMod * 100, hMod * 200)
	label:SetTextColor( Color( 0, 0, 0, 255 ) )
	for k,v in pairs (sh_gm.Jobs) do
	label:SetText(sh_gm.Jobs[k].name)
	TextLabelsList:AddItem(label)
	end


For some reason it just shows me the last table, and not all of them with some spaces in.

bump

EDIT: Fixed it, but i got one problem.
I cant see the actuall thing that you use to scroll down, anyone has any clue about it?

Fixed ^^.
another question :stuck_out_tongue:
I want to draw a box, but when i do it, i cant see it, unless its in a :Paint function, and when its there, the function just keeps occuring, so it doesn’t help me.
This is my for loop:



	for k,v in pairs (sh_gm.Jobs) do

If i put a draw.RoundedBox there, it doesn’t appear.
any ideas?