So I am having problems with adding a DPropertySheet to a menu that uses + and - commands.
[lua] function Menu1()
CFrame = vgui.Create('DFrame')
CFrame:SetSize(400, 300)
CFrame:SetPos(481, 262)
CFrame:SetVisible(false) --so it dont appear on start up
CFrame:SetTitle('Censored')
CFrame:SetDeleteOnClose(false)
CFrame:MakePopup()
local PSheet1 = vgui.Create("DPropertySheet")
PSheet1:SetParent("CFrame")
PSheet1:SetVisible(false)
PSheet1:SetPos(479, 260)
PSheet1:SetSize(298,298)
local SheetItemOne = vgui.Create( "DCheckBoxLabel" )
SheetItemOne:SetText( "Use Props?" )
SheetItemOne:SetConVar( "some_convar" )
SheetItemOne:SetValue( 1 )
SheetItemOne:SizeToContents()
PSheet1:AddSheet("Settings", SheetItemOne, "gui/silkicons/user", false, false, "Settings" )
end
function openup()
CFrame:SetVisible(true)
end
function closedown()
CFrame:SetVisible(false)
end
concommand.Add("-c_menu",closedown)
concommand.Add("+c_menu",openup)
hook.Add("Initialize","Menu1",Menu1)[/lua]
How can I make it so that the PropertySheet only appears while I have my key bound to +c_menu held down? Also I am not sure what I did wrong but this is how it looks in game.
[img_thumb]http://img215.imageshack.us/img215/5032/dpsu.png[/img_thumb]
So how can I make is so that it is parented and will appear and disappear with the rest of the frame?
Also in this line right here
[lua]PSheet1:AddSheet("Settings", SheetItemOne, "gui/silkicons/user", false, false, "Settings" )[/lua]
Where is says SheetItemOne, do you have to include EVERYTHING you want on the page in that spot right there?
Thanks for the help.
Awesome! Thank you! That [u]should[/u] make it appear and disappear with the DFrame correct?
[EDITLINE] 10:23 [/EDITLINE]
Yeah I'm not sure, but I think the DPropertySheet is now behind my menu, because I get no errors at all but it doesn't appear. I changed it to be parented the correct way, so I don't think that's the issue
[lua]function Menu1()
CFrame = vgui.Create('DFrame')
CFrame:SetSize(400, 300)
CFrame:SetPos(481, 262)
CFrame:SetVisible(false) --so it dont appear on start up
CFrame:SetTitle('Censored')
CFrame:SetDeleteOnClose(false)
CFrame:MakePopup()
local PSheet1 = vgui.Create("DPropertySheet")
PSheet1:SetParent(CFrame)
PSheet1:SetPos(479, 260)
PSheet1:SetSize(298,298)
local SheetItemOne = vgui.Create( "DCheckBoxLabel" )
SheetItemOne:SetText( "Use Props?" )
SheetItemOne:SetConVar( "some_convar" )
SheetItemOne:SetValue( 1 )
SheetItemOne:SizeToContents()
PSheet1:AddSheet("Settings", SheetItemOne, "gui/silkicons/user", false, false, "Settings" )
end
function openup()
CFrame:SetVisible(true)
end
function closedown()
CFrame:SetVisible(false)
end
concommand.Add("-c_menu",closedown)
concommand.Add("+c_menu",openup)
hook.Add("Initialize","Menu1",Menu1)[/lua]
All I did was update the parenting to the correct way, and then removed PSheet1:SetVisible(false)
Ah, I didn't even think about that! Thanks!
[EDITLINE]10:46[/EDITLINE]
Yup! Just tested in game. Works flawlessly - until I fuck something else up - thanks again.
Sorry, you need to Log In to post a reply to this thread.