• HTML VGUI How to close?
    4 replies, posted
I am creating a vgui HTML on player spawn but cannot seem to find a way to close it...here is what I have so far: [CODE]function openSteamGroup() HTMLTest = vgui.Create("HTML") HTMLTest:SetPos(50,50) HTMLTest:SetSize(ScrW() - 100, ScrH() - 100) HTMLTest:OpenURL("http://steamcommunity.com/groups/legendscript") closeButton = vgui.Create("DButton", HTMLTest) closeButton:SetText( "Close" ) closeButton:SetPos( 50, 50) closeButton:SizeToContents() closeButton.DoClick = function() HTMLTest:Close() end end openSteamGroup()[/CODE] The close button does not work...it displays but once clicked it stays clicked and the html window does not close.
Use a DFrame, or DPanel as the primary window, then put the HTML window inside that with the close button. If you use a DFrame, a close button will be automatically put into place. Just position the HTML window a little lower.
have you tried HTMLTest:Remove() ?
Solved: [CODE]if (CLIENT) then function openSteamGroup() MenuTest=vgui.Create("DFrame") MenuTest:SetPos(50,50) MenuTest:SetSize(ScrW() - 100, ScrH() - 100) HTML1 = vgui.Create("HTML", MenuTest) HTML1:SetPos(50,50) HTML1:SetSize(ScrW() - 150, ScrH() - 150) HTML1:OpenURL("http://steamcommunity.com/groups/legendscript") end openSteamGroup() end //[/CODE] Thanks AceCool! By the way, HTMLTest:Remove does not work. I do not understand why though...
[QUOTE=MGCLegend;44540539]Solved: [CODE]if (CLIENT) then function openSteamGroup() MenuTest=vgui.Create("DFrame") MenuTest:SetPos(50,50) MenuTest:SetSize(ScrW() - 100, ScrH() - 100) HTML1 = vgui.Create("HTML", MenuTest) HTML1:SetPos(50,50) HTML1:SetSize(ScrW() - 150, ScrH() - 150) HTML1:OpenURL("http://steamcommunity.com/groups/legendscript") end openSteamGroup() end //[/CODE] Thanks AceCool! By the way, HTMLTest:Remove does not work. I do not understand why though...[/QUOTE] I was using it today and it worked fine for me. Assuming you're using Remove() not Remove.
Sorry, you need to Log In to post a reply to this thread.