• EnableVerticalScrollbar( true ) not working
    27 replies, posted
Hey guys. I've been working on a gamemode and ive run into a problem. I created a Derma menu with a property sheet with tabs. The first one looks like this [CODE] local JobsTab= vgui.Create( "DPanelList" ) JobsTab:SizeToContents() JobsTab:SetPos( 5, 50 ) JobsTab:SetSize( 150, 380 ) JobsTab:EnableVerticalScrollbar( true ) JobsTab:EnableHorizontal( true ) [/CODE] I have some items on the panel list that extend past the frame so i used JobsTab:EnableVerticalScrollbar( true ), however the vertical scroll bar does not show up :/ not sure what i did wrong
Anyone have any idea? I have a derma frame with a property sheet and n the property sheet is a DPanelList. I have some items on that DPaneList that extend past the page and the veticial scroll bar is no where to be seen.
Do Enable Horizontal false! and try again
[QUOTE=commander204;18076611]Do Enable Horizontal false! and try again[/QUOTE] Would not help. As for the OP, try adding a bunch more items and tell me if it still doesn't show. Sometimes if you only have items that are being half cutoff by the panel it won't register it and won't show the scrollbar.
[QUOTE=Entoros;18077097]Would not help. As for the OP, try adding a bunch more items and tell me if it still doesn't show. Sometimes if you only have items that are being half cutoff by the panel it won't register it and won't show the scrollbar.[/QUOTE] He did not say where they are extending to >>
I tried what both of you said and it still doesnt work. I'm using a property sheet with a DpanelList attached to it and im not sure why it isnt working...
Can you post the rest of your code then?
JobsTab:EnableVerticalScrollbar() There are no parameters
[QUOTE=gmt2001;18086734]JobsTab:EnableVerticalScrollbar() There are no parameters[/QUOTE] what do you mean? :S
i have a script which sues the same element types. I run EnableVerticalScrollbar with NO parameters, as it is written in my above post
Alright how do you suggest I fix it then because I am new to Lua. Should I post my full code for you to see because I don't exactly get what you're saying
This is your current code [CODE] local JobsTab= vgui.Create( "DPanelList" ) JobsTab:SizeToContents() JobsTab:SetPos( 5, 50 ) JobsTab:SetSize( 150, 380 ) JobsTab:EnableVerticalScrollbar( true ) JobsTab:EnableHorizontal( true ) [/CODE] Try changing your code to this [CODE] local JobsTab= vgui.Create( "DPanelList" ) JobsTab:SizeToContents() JobsTab:SetPos( 5, 50 ) JobsTab:SetSize( 150, 380 ) JobsTab:EnableVerticalScrollbar() JobsTab:EnableHorizontal( true ) [/CODE]
Doesn't work :/ Does anyone have any other ideas? This is so frustrating [editline]01:32AM[/editline] Here's a picture of my little menu so far. [IMG]http://img687.imageshack.us/img687/7748/dermamenu.jpg[/IMG] As you can see, at the bottom are some more classes and items. However, the vertical scroll bar doesnt show um and not sure why : /
gmt, get out until you know derma. If you say EnableVerticalScrollbar(false) it makes it disappear, so you need the boolean argument. Anyway, Gun, what I meant was can you please post the code where you populate the DPanelList? (like, use the AddItem function)
[CODE]local PropertySheet = vgui.Create( "DPropertySheet" ) PropertySheet:SetParent( InfoList ) PropertySheet:SetPos( 8, 30 ) PropertySheet:SetSize( 330, 455 ) PropertySheet:SetVisible( true ) local SheetItemOne = vgui.Create( "DPanelList" ) SheetItemOne:SetPos( 5, 50 ) SheetItemOne:SetSize( 150, 470 ) SheetItemOne:EnableHorizontal( true ) SheetItemOne:EnableVerticalScrollbar( true ) SheetItemOne.Paint = function() draw.RoundedBox( 6, 1, 20, 260, 74, Color( 25, 25, 25, 150 ) ) draw.RoundedBox( 6, 1, 100, 260, 74, Color( 25, 25, 25, 150 ) ) draw.RoundedBox( 6, 1, 180, 260, 74, Color( 25, 25, 25, 150 ) ) draw.RoundedBox( 6, 1, 260, 260, 74, Color( 25, 25, 25, 150 ) ) draw.RoundedBox( 6, 1, 340, 260, 74, Color( 25, 25, 25, 150 ) ) draw.RoundedBox( 6, 1, 420, 260, 74, Color( 25, 25, 25, 150 ) )[/CODE] [CODE] local CitizenIcon = vgui.Create( "SpawnIcon", SheetItemOne ) CitizenIcon:SetModel( "models/player/Group01/Male_01.mdl" ) CitizenIcon:SetPos( 5, 25 ) CitizenIcon:SetToolTip() SheetItemOne:SetPadding( 4 ) SheetItemOne:AddItem( icon ) CitizenIcon.DoClick = function( icon ) RunConsoleCommand( "Citizen" ) InfoList:SetVisible( false) end local CombineIcon = vgui.Create( "SpawnIcon", SheetItemOne ) CombineIcon:SetModel( "models/Police.mdl" ) CombineIcon:SetPos( 5, 105 ) CombineIcon:SetToolTip() SheetItemOne:SetPadding( 4 ) SheetItemOne:AddItem( icon ) CombineIcon.DoClick = function( icon ) RunConsoleCommand( "CCU" ) InfoList:SetVisible( false) end local CombineLIcon = vgui.Create( "SpawnIcon", SheetItemOne ) CombineLIcon:SetModel( "models/Combine_Super_Soldier.mdl" ) CombineLIcon:SetPos( 5, 185 ) CombineLIcon:SetToolTip() SheetItemOne:SetPadding( 4 ) SheetItemOne:AddItem( icon ) CombineLIcon.DoClick = function( icon ) RunConsoleCommand( "CCUL" ) InfoList:SetVisible( false) end local CA = vgui.Create( "SpawnIcon", SheetItemOne ) CA:SetModel( "models/breen.mdl" ) CA:SetPos( 5, 265 ) CA:SetToolTip() SheetItemOne:SetPadding( 4 ) SheetItemOne:AddItem( icon ) CA.DoClick = function( icon ) RunConsoleCommand( "CA" ) InfoList:SetVisible( false) end local Rebel = vgui.Create( "SpawnIcon", SheetItemOne ) Rebel:SetModel( "models/Humans/Group03/male_02.mdl" ) Rebel:SetPos( 5, 345 ) Rebel:SetToolTip() SheetItemOne:SetPadding( 4 ) SheetItemOne:AddItem( icon ) Rebel.DoClick = function( icon ) RunConsoleCommand( "Rebel" ) InfoList:SetVisible( false) end[/CODE]
Hurr. Ok, here's your problem. DPanelLists do NOT like it when you override their paint. Bad, bad idea. Instead of overriding the paint to get the effect you're going for, what you need to do is [b]add a panel object[/b], not the spawnicon. You can paint the panel however you want, and the menu will parse it fine.
[QUOTE]what you need to do is add a panel object, not the spawnicon[/QUOTE] How do i do that?
[lua]local pan = vgui.Create("DPanel") pan:SetSize(250,100) pan.Paint = function() -- Painting stuff here draw.RoundedBox(0,0,pan:GetWide(),pan:GetTall(),color_white) end local icon = vgui.Create("SpawnIcon",pan) icon:SetPos(5,5) icon:SetSize(50,50) icon:SetModel("modelhere") SheetItemOne:AddItem(pan)[/lua] You make the panel, override the paint with whatever you want, and then add whatever children elements you want.
Oh, so add a Panel to the Panellist for ever icon?
Right. One thing to make note of is that instead of creating a Panel1, Panel2, Panel3... and so forth, you can make a table of the data you want to use for the panel, and use a for loop to create a panel with each bit of info.
I ran into one problem. The paint doesn't stick to the Panel when you scroll down... Not sure why. You scroll down and the icons go down, however the the text and boxes etc stay put and go scroll.
Let me see the code you're using.
Oh, nevermind forgot to use Additem. But, is there an easy way to place items on a panel individually without them being like stuck together?
[QUOTE=GUNH0G;18089816]Oh, nevermind forgot to use Additem. But, is there an easy way to place items on a panel individually without them being like stuck together?[/QUOTE] What do you mean?
Well, the icons are like right next to each other unless i use SheetItemOne:SetSpacing(200). Which sets the icons really far apart. Im asking is there anyway to make the icons not stick together like that and place them somewhere on the panel with SetPos or something?
[QUOTE=GUNH0G;18089984]Well, the icons are like right next to each other unless i use SheetItemOne:SetSpacing(200). Which sets the icons really far apart. Im asking is there anyway to make the icons not stick together like that and place them somewhere on the panel with SetPos or something?[/QUOTE] Um, not using SheetItemOne:SetSpacing(200) with an argument of 200 would be a start.
[QUOTE=Entoros;18088923]gmt, get out until you know derma. If you say EnableVerticalScrollbar(false) it makes it disappear, so you need the boolean argument. Anyway, Gun, what I meant was can you please post the code where you populate the DPanelList? (like, use the AddItem function)[/QUOTE] Tell that to my addon which doesnt need no stinking argument
[url]http://luabin.foszor.com/code/addons/derma/lua/vgui/DPanelList.lua#84[/url] It takes no argument, gmt2001 is correct.
Sorry, you need to Log In to post a reply to this thread.