• Scrolly thingy in a panel list?
    4 replies, posted
I have a panel list and I want to add more things in it like you will be actually able to scroll down it. [code]function PurchaseStuff( ) local W, H = 500, 250 local DermaPanel = vgui.Create("DFrame") DermaPanel:SetPos(ScrW() * .5 - W * .5, ScrH() * .5 - H * .5) DermaPanel:SetSize(W, H) DermaPanel:SetTitle("Vehicle Garage") DermaPanel:SetVisible(true) DermaPanel:SetDraggable(false) DermaPanel:ShowCloseButton(true) local PanelList1 = vgui.Create("DPanelList", DermaPanel) PanelList1:EnableHorizontal(false) PanelList1:EnableVerticalScrollbar(true) PanelList1:StretchToParent(5, 30, 5, 5) PanelList1:SetPadding(5) PanelList1:SetSpacing(5) DermaPanel:MakePopup() local BuySpyder = vgui.Create( "DButton" ) BuySpyder:SetText( "Buy Spyder" ) BuySpyder:SetSize( 150, 50 ) BuySpyder.DoClick = function () DermaPanel:Close() LocalPlayer():ChatPrint("Congratulations you have successfully baughten that car!") RunConsoleCommand("rp_c_1") end PanelList1:AddItem( BuySpyder ) local BuyBlista = vgui.Create( "DButton" ) BuyBlista:SetText( "Buy Blista" ) BuyBlista:SetSize( 150, 50 ) BuyBlista.DoClick = function () DermaPanel:Close() LocalPlayer():ChatPrint("Congratulations you have successfully baughten that car!") RunConsoleCommand("rp_c_2") end PanelList1:AddItem( BuyBlista ) local BuyBMWM5 = vgui.Create( "DButton" ) BuyBMWM5:SetText( "Buy BMW-M5" ) BuyBMWM5:SetSize( 150, 50 ) BuyBMWM5.DoClick = function () DermaPanel:Close() LocalPlayer():ChatPrint("Congratulations you have successfully baughten that car!") RunConsoleCommand("rp_c_3") end PanelList1:AddItem( BuyBMW5 ) local BuyVanquish = vgui.Create( "DButton" ) BuyVanquish:SetText( "Buy Vanquish" ) BuyVanquish:SetSize( 150, 50 ) BuyVanquish.DoClick = function () DermaPanel:Close() LocalPlayer():ChatPrint("Congratulations you have successfully baughten that car!") RunConsoleCommand("rp_c_4") end PanelList1:AddItem( BuyVanquish ) end[/code] Is my menu, the fourth option is like in the top of the screen. I want it to be able to continue down in the panel (Like [URL="http://i.imgur.com/nKMqx.png"]http://i.imgur.com/nKMqx.png[/URL] )
Have you looked at the code for that?
The PanelList should automatically extend if you allow the vertical scrollbar. Add enough items to reach the bottom of your panel or just make the derma frame smaller.
It doesn't automatically extend, the fourth item I've added should make it a scroll bar but instead it appears at the top of the screen...
PanelList1:AddItem( BuyBMW5 ) Solved. Its PanelList1:AddItem( BuyBMWM5 )
Sorry, you need to Log In to post a reply to this thread.