Hey guys so I am trying to make a simple dproperty sheet menu because I want to learn how to utilize it. However, I ran into a issue. When I switch tabs my button is still there from the first tab. All help/points are appreciated thanks!
[CODE]
local MainFrame = vgui.Create( "DFrame" )
MainFrame:SetTitle( "Menu" )
MainFrame:SetSize( ScrH()*1, ScrW()*0.5 )
MainFrame:Center()
MainFrame:MakePopup()
MainFrame.Paint = function( self, w, h ) -- 'function Frame:Paint( w, h )' works too
draw.RoundedBox( 12, 0, 0, w, h, Color( 55, 55, 95, 150 ) )
end
local sheet = vgui.Create( "DPropertySheet", MainFrame )
--sheet:SetParent( MainMenu )
sheet:Dock( FILL )
local panel1 = vgui.Create( "DPanel", sheet )
panel1.Paint = function( self, w, h ) draw.RoundedBox( 4, 0, 0, w, h, Color( 0, 0, 0,190 ) ) end
sheet:AddSheet( "Commands", panel1, "icon16/application.png" )
local TestButton = vgui.Create( "DButton", sheet )
TestButton:SetText( "Say hi" )
TestButton:SetPos( 25, 50 )
TestButton:SetSize( 250, 30 )
TestButton.DoClick = function()
RunConsoleCommand( "say", "Hi" )
end
local paneltwo = vgui.Create( "DPanel", sheet )
paneltwo.Paint = function( self, w, h ) draw.RoundedBox( 4, 0, 0, w, h, Color( 0, 0, 0,190 ) ) end
sheet:AddSheet( "Classes", paneltwo, "icon16/user.png" )
[/CODE]
PICTURES OF ISSUE:
[url]https://gyazo.com/321f9e4fe84448e354fef7cd298b958a[/url] --FIRST TAB
[url]https://gyazo.com/e42bfe8136b9f354502d9ec54fbf5802[/url] -- SECOND TAB
Set the button's parent to the sheet itself rather than the propertysheet.
[CODE]local TestButton = vgui.Create( "DButton", panel1 )[/CODE]
Sorry, you need to Log In to post a reply to this thread.