I've made a panel for a website which works great, but I'm having trouble adding a button to refresh the webpage. Is there any way to do this?
Here is my code:
[code]local bored = {
["URL"] = "";
};
function bored.CreatePanel( )
local w = 800; -- Width
local h = 600; -- Height
local p = 8; -- Padding
bored.Frame = vgui.Create( "DFrame" );
bored.Frame:SetTitle( "Bored" );
bored.Frame:SetSize( w + (p * 2), h + (p * 5) );
bored.Panel = vgui.Create( "DPanel", bored.Frame );
bored.Panel:SetPos( 8, 32 );
bored.Panel:SetSize( w, h );
bored.HTML = vgui.Create( "HTML", bored.Panel );
bored.HTML:SetPos( 8, 8 );
bored.HTML:SetSize( w - (p * 2), h - (p * 2) );
bored.HTML:OpenURL( bored.URL );
bored.Frame:Center();
bored.Frame:MakePopup();
end
hook.Add( "OnPlayerChat", "boredCommand", function( ePlayer, sText )
if ( ePlayer ~= LocalPlayer() ) then
return;
end
if ( string.StartWith( string.lower( sText ), "!bored" ) ) then
bored.CreatePanel( );
return;
end
end );[/code]
I think it's something along the lines of adding:
[code]local DermaButton = vgui.Create( "DButton" )
DermaButton:SetParent( DermaPanel ) -- Set parent to our "DermaPanel"
DermaButton:SetText( "Kill yourself" )
DermaButton:SetPos( 25, 50 )
DermaButton:SetSize( 150, 50 )
DermaButton.DoClick = function ()
end[/code]
Found a work-around, nevermind :v:
Mark your thread as solved please if you don't need any help.
Sorry, you need to Log In to post a reply to this thread.