• Dumb VGUI question
    3 replies, posted
how can i make it so that it is impossible to close a VGUI menu until you pick an option? also, how can i make a VGUI appear in the Direct middle of the screen, and pop up after the MOTD is closed?
That makes it pop up in the center of the screen. There's an example of a spawn icon and a button. [LUA] Test() local Frame = vgui.Create("DFrame") Frame:SetPos( 20, 20 ) Frame:SetSize( 400, 335 ) Frame:Center( true ) Frame:SetTitle( "Testing" ) Frame:ShowCloseButton( false ) gui.EnableScreenClicker( true ) local Frame1 = vgui.Create( "DButton" ) Frame1:SetParent( Frame ) -- Set parent to our "DermaPanel" Frame1:SetText( "Yes, I would like some medical attetion." ) Frame1:SetPos( 5, 25 ) Frame1:SetSize( 290, 30 ) Frame1.DoClick = function () RunConsoleCommand("say","I Chose this one!") Frame:Close() gui.EnableScreenClicker( false ) end local Icon = vgui.Create( "SpawnIcon") Icon:SetParent( Frame ) Icon:SetPos( 5, 55 ) Icon:SetModel("models/police.mdl" ) Icon.DoClick = function() RunConsoleCommand("Say", "I choose this one!") Frame:Close() gui.EnableScreenClicker( false ) end end concommand.Add("test", Test) [/LUA] I don't know how to make it pop up after the MOTD is close though.
Like fail showed you above [lua]Frame:ShowCloseButton( false )[/lua] disables the close button in the top right. Make your own close button that calls the next menu when it is clicked. [lua] local button = vgui.Create( "DButton" ) button:SetSize( 100, 30 ) button:SetPos( 50, 30 ) button:SetText( "Close Motd" ) button.DoClick = function( button ) nameofmotdframe:Close() NAME_OF_NEXT_MENU() end [/lua] Also for [lua] Frame:Center( true ) [/lua] I don't think you need true in there, so if it errors try it w/o true.
[lua]local DFrame = vgui.Create( "DFrame" ) DFrame:Center()[/lua] [lua] local button = vgui.Create( "DButton" ) button:SetSize( 100, 30 ) button:SetPos( 50, 30 ) button:SetText( "Close Motd" ) button.DoClick = function( button ) nameofmotdframe:SetVisible(false) YourMenu:SetVisible(true) end [/lua]
Sorry, you need to Log In to post a reply to this thread.