• Tabbed Menu
    4 replies, posted
I have created a tabbed Derma Menu, its client side, for me only, but i wanted to make a DPanel in the first tab, but the panel is invisble! how to fix this? [lua] function MyCoolMenu() local ply = LocalPlayer() local BG = vgui.Create( "DFrame" ) BG:SetSize( 700, 650 ) BG:SetPos( (ScrW()/2)-BG:GetWide(),(ScrH()/2)-BG:GetTall() ) BG:SetTitle ( "My Cool Menu!" ) BG:SetVisible ( true ) BG:SetDraggable( true ) BG:ShowCloseButton ( true ) BG:Center() BG:MakePopup() BG.Paint = function() draw.RoundedBox(4, 0, 0, BG:GetWide(), BG:GetTall(), Color(255, 175, 0, 200)) draw.RoundedBox(4, 2, 2, BG:GetWide()-4, 21, Color(50, 50, 50, 200)) end local PropertySheet = vgui.Create( "DPropertySheet", BG ) PropertySheet:SetPos( 5, 30 ) PropertySheet:SetSize( 680, 630 ) function PropertySheet:Paint() self:SetBGColor(150, 100, 0, 200) end ---------------------------------------------------------------------------------------------------------- -- FROM HERE: ---------------------------------------------------------------------------------------------------------- local Menu1 = vgui.Create( "DPanel" ) Menu1:SetPos( 30, 30 ) --Menu1:SetSize( 250, 250 ) Menu1:SetWide( 250 ) Menu1:SetTall( 250 ) Menu1:SetVisible ( true ) Menu1.Paint = function() -- Paint function surface.SetDrawColor( 255, 0, 0, 255) --Red surface.DrawRect(20, Menu1:GetWide(), Menu1:GetTall(), 0 ) end ---------------------------------------------------------------------------------------------------------- -- TO HERE: ---------------------------------------------------------------------------------------------------------- /*##################################################### ### Menu1 Items: ### #####################################################*/ local PlayerLabel = vgui.Create ( "DLabel" , Menu1 ) PlayerLabel:SetPos(5,10) PlayerLabel:SetText( "Select a Player!" ) PlayerLabel:SizeToContents() local MultiChoice = vgui.Create( "DMultiChoice", Menu1 ) MultiChoice:SetPos(10,25) MultiChoice:SetTall( 20 ) MultiChoice:SetWide( 100 ) MultiChoice:SetEditable( false ) function MultiChoice:OnSelect(index,value,data) DMultiChoiceValue = value end for _,ply in pairs(player.GetAll()) do MultiChoice:AddChoice(ply:Nick()) end local TextEntry = vgui.Create ( "DTextEntry", Menu1 ) TextEntry:SetPos( 120,25 ) TextEntry:SetTall( 20 ) TextEntry:SetWide( 100 ) TextEntry:SetEnterAllowed( true ) TextEntry.OnEnter = function() ply:ConCommand("say "..DMultiChoiceValue.." - "..TextEntry:GetValue()) BG:SetVisible( false ) end /*##################################################### ### Menu2 Items: ### #####################################################*/ local Menu2 = vgui.Create( "DPanel" ) Menu2:SetPos( 25, 50 ) Menu2:SetSize( 140, 110 ) function Menu2:Paint() self:SetBGColor(150, 150, 0, 200) end --#####################################################-- PropertySheet:AddSheet( "MyCoolMenu 1", Menu1, "gui/silkicons/user", false, false, "MyCoolMenu 1" ) PropertySheet:AddSheet( "MyCoolMenu 2", Menu2, "gui/silkicons/group", false, false, "MyCoolMenu 2" ) end concommand.Add( "MyCoolMenu", MyCoolMenu) [/lua]
[lua] surface.DrawRect(20, Menu1:GetWide(), Menu1:GetTall(), 0 ) -- arguments should be x,y,wide, tall -- try this: surface.DrawRect(0, 0, Menu1:GetWide(), Menu1:GetTall() )[/lua]
nope, dosent work, but thanks for your try :)
[lua] function MyCoolMenu(ply,cmd,args) local BG = vgui.Create( "DFrame" ) BG:SetSize( 700, 650 ) BG:SetPos( (ScrW()/2)-BG:GetWide(),(ScrH()/2)-BG:GetTall() ) BG:SetTitle ( "My Cool Menu!" ) BG:SetVisible ( true ) BG:SetDraggable( true ) BG:ShowCloseButton ( true ) BG:Center() BG:MakePopup() BG.Paint = function() draw.RoundedBox(4, 0, 0, BG:GetWide(), BG:GetTall(), Color(255, 175, 0, 200)) draw.RoundedBox(4, 2, 2, BG:GetWide()-4, 21, Color(50, 50, 50, 200)) end local PropertySheet = vgui.Create( "DPropertySheet", BG ) PropertySheet:SetPos( 5, 30 ) PropertySheet:SetSize( 680, 630 ) function PropertySheet:Paint() self:SetBGColor(150, 100, 0, 200) end ---------------------------------------------------------------------------------------------------------- -- FROM HERE: ---------------------------------------------------------------------------------------------------------- local Menu1 = vgui.Create( "DPanel" ) Menu1:SetPos( 30, 30 ) Menu1:SetSize( 250, 250 ) Menu1.Paint = function() -- Paint function draw.RoundedBox(0,0,0,Menu1:GetWide(),Menu1:GetTall(),Color(255,0,0,255)) end ---------------------------------------------------------------------------------------------------------- -- TO HERE: ---------------------------------------------------------------------------------------------------------- /*##################################################### ### Menu1 Items: ### #####################################################*/ local PlayerLabel = vgui.Create ( "DLabel" , Menu1 ) PlayerLabel:SetPos(5,10) PlayerLabel:SetText( "Select a Player!" ) PlayerLabel:SizeToContents() local MultiChoice = vgui.Create( "DMultiChoice", Menu1 ) MultiChoice:SetPos(10,25) MultiChoice:SetTall( 20 ) MultiChoice:SetWide( 100 ) MultiChoice:SetEditable( false ) function MultiChoice:OnSelect(index,value,data) DMultiChoiceValue = value end for _,ply in pairs(player.GetAll()) do MultiChoice:AddChoice(ply:Nick()) end local TextEntry = vgui.Create ( "DTextEntry", Menu1 ) TextEntry:SetPos( 120,25 ) TextEntry:SetTall( 20 ) TextEntry:SetWide( 100 ) TextEntry:SetEnterAllowed( true ) TextEntry.OnEnter = function() ply:ConCommand("say "..DMultiChoiceValue.." - "..TextEntry:GetValue()) BG:SetVisible( false ) end /*##################################################### ### Menu2 Items: ### #####################################################*/ local Menu2 = vgui.Create( "DPanel" ) Menu2:SetPos( 25, 50 ) Menu2:SetSize( 140, 110 ) function Menu2:Paint() self:SetBGColor(150, 150, 0, 200) end --#####################################################-- PropertySheet:AddSheet( "MyCoolMenu 1", Menu1, "gui/silkicons/user", false, false, "MyCoolMenu 1" ) PropertySheet:AddSheet( "MyCoolMenu 2", Menu2, "gui/silkicons/group", false, false, "MyCoolMenu 2" ) end concommand.Add( "MyCoolMenu", MyCoolMenu) [/lua] tested and working, simple fix, btw to save lines of code, just use draw.RoundedBox :) and set the rounded to 0
[QUOTE=antid2;24204577] tested and working, simple fix, btw to save lines of code, just use draw.RoundedBox :) and set the rounded to 0[/QUOTE] Thats pretty inefficient. Use surface.SetDrawColor() and surface.DrawRect(). For the record, draw.DrawRoundedBox draws 5 rects and when drawn with rounded corners it also draws 4 rotated textured rects.
Sorry, you need to Log In to post a reply to this thread.