• DPropertySheet Assistance, Please
    2 replies, posted
Hello folks, I had to impose upon you but I need help with this, specifically getting multiple things like DNumSliders on one Property sheet. [lua] function Mayor_Desk_Draw() local ScrWHalf,ScrHHalf ScrWHalf=ScrW() / 2 ScrHHalf=ScrH() / 2 local DeskWin=vgui.Create("DFrame") DeskWin:SetPos(ScrWHalf / 2,ScrHHalf / 2) DeskWin:SetSize(ScrWHalf,ScrHHalf) DeskWin:SetTitle("Mayor's Desk") DeskWin:SetVisible(true) DeskWin:SetDraggable(true) DeskWin:ShowCloseButton(true) DeskWin:MakePopup() DeskWin.Paint = function() surface.SetDrawColor(Color(255,255,255,255)) local x,y=DeskWin:GetPos() local xv,yv=DeskWin:GetSize() surface.DrawRect(0,0,ScrWHalf,ScrHHalf) end local MayorSheet=vgui.Create("DPropertySheet",DeskWin) MayorSheet:SetPos(0,22) MayorSheet:SetSize(ScrWHalf,ScrHHalf) local balance=vgui.Create("DLabel") balance:SetText("Balance: $"..GetGlobalInt("wrp_treasury")) balance:SetColor(Color(0,255,0,255)) balance:SetPos(0,22) local IncomeTax=vgui.Create("DNumSlider",balance) IncomeTax:SetPos(0,100) IncomeTax:SetMinMax(0,1.0) IncomeTax:SetDecimals(2) IncomeTax:SetText("Income Tax") MayorSheet:AddSheet("Treasury",balance,"gui/silkicons/page",false,false,"Manage your budget") end concommand.Add("wrp_mayor_desk_use",Mayor_Desk_Draw) [/lua]
You use a DPanel for the tab and then put the labels, etc onto that DPanel, then you add it as a tab to the DPropertySheet
I see you've parented NumSlider to the Label, I don't think it's a smart thing to do. You should parent all elements of "Balance" tab to a panel and then add it via AddSheet(). If you don't like it putting another layer onto whole menu, you can always set it's alpha to 0
Sorry, you need to Log In to post a reply to this thread.