I'm trying to make a button and set it so it only comes up on one tab. The problem is the button is behind the menu so you can't see it. I have no clue on how to fix this so any help would be appreciated. Here's my full code.
[LUA]
function Menu()
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50,50 )
DermaPanel:SetSize( 700, 500 )
DermaPanel:SetTitle( "Mayor Menu" )
DermaPanel:SetVisible( true )
DermaPanel:Center()
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
local PropertySheet = vgui.Create( "DPropertySheet" )
PropertySheet:SetParent( DermaPanel )
PropertySheet:SetPos( 5, 30 )
PropertySheet:SetSize( 690, 457 )
local SheetItemOne = vgui.Create( "DFrame" )
SheetItemOne:SetSize( 690, 457 )
SheetItemOne:SetPos( 50, 50 )
SheetItemOne:SetTitle("")
SheetItemOne:ShowCloseButton( false )
SheetItemOne.Paint = function()
surface.SetDrawColor( 50, 50, 50, 255 )
surface.DrawRect( 0, 0, SheetItemOne:GetWide(), SheetItemOne:GetTall() )
end
-- SHEET ONE
local text = vgui.Create("DLabel")
text:SetText("Mayor Information" )
text:SetFont("HUDNumber5")
text:SetPos( 5, 10 )
text:SetParent( SheetItemOne )
text:SizeToContents()
local text = vgui.Create("DLabel")
text:SetText("General Information:\n\nAs Mayor your job is to keep the city free of crime and violence\n\nyou make laws that are for the greater good of the the city\n\nIf the citizens do not follow the laws,\n\nThey will be put in jail and tryed before you.\n\nas Mayor you get to decide what there punishment is.")
text:SetFont("Trebuchet22")
text:SetPos( 5, 60 )
text:SetParent( SheetItemOne )
text:SizeToContents()
local pModel = vgui.Create("DModelPanel" ,SheetItemOne)
pModel:SetPos(370,10)
pModel:SetSize(400,400)
pModel:SetModel("models/player/breen.mdl")
pModel:SetAnimated(ACT_WALK)
pModel:SetAnimSpeed(0.5)
-- SHEET 2
local SheetItemTwo = vgui.Create( "DFrame" )
SheetItemTwo:SetSize( 690, 457 )
SheetItemTwo:SetPos( 50, 50 )
SheetItemTwo:SetTitle("")
SheetItemTwo:ShowCloseButton( false )
SheetItemTwo.Paint = function()
surface.SetDrawColor( 50, 50, 50, 255 )
surface.DrawRect( 0, 0, SheetItemTwo:GetWide(), SheetItemTwo:GetTall() )
end
local text = vgui.Create("DLabel")
text:SetText("How Do I become Mayor?" )
text:SetFont("HUDNumber5")
text:SetPos( 5, 10 )
text:SetParent( SheetItemTwo )
text:SizeToContents()
local text = vgui.Create("DLabel")
text:SetText("It's Simple!\n\nAll you have to do is press the button at the bottom right of the menu\n\nIf there is allready a Mayor you can't vote to become one though\n\nIf there is a mayor you will have to wait for him to be asssassianted or for hm to retire.")
text:SetFont("Trebuchet22")
text:SetPos( 5, 60 )
text:SetParent( SheetItemTwo )
text:SizeToContents()
local textt = vgui.Create("DLabel")
textt:SetText("(Click to Become Mayor)")
textt:SetFont("Trebuchet22")
textt:SetPos( 230, 275 )
textt:SetParent( SheetItemTwo )
textt:SizeToContents()
local DermaButton = vgui.Create( "DButton" )
DermaButton:SetParent( SheetItemTwo )
DermaButton:SetText( "Become Mayor" )
DermaButton:SetPos( 225, 300 )
DermaButton:SetSize( 200, 75 )
DermaButton:MakePopup()
DermaButton.DoClick = function ()
Msg("Testing")
end
PropertySheet:AddSheet( "Mayoral Duties", SheetItemOne, "gui/silkicons/user", false, false, "Information" )
PropertySheet:AddSheet( "Becomming Mayor", SheetItemTwo, "gui/silkicons/group", false, false, "Information" )
end
concommand.Add("menu", Menu)
[/LUA]
*facepalm* parent the button to the frame/panel or whatever the button is supposed to be on top of
also, dont name the variables the same
[QUOTE=iRzilla;27010775]Yes I took it as a snippet from the OP's code. Should I of used [noparse][/noparse] tags to make it easier for you to understand?[/QUOTE]
yes
Sorry, you need to Log In to post a reply to this thread.