Html Panel?

[lua]
function Book( ply, cmd, args )
HTMLTest = vgui.Create(“HTML”)
HTMLTest:SetPos(50,50)
HTMLTest:SetSize(ScrW() - 400, ScrH() - 400)
HTMLTest:Center()
HTMLTest:SetTitle( “Chapter One - Infections” )
HTMLTest:SetDraggable( true )
HTMLTest:ShowCloseButton( false )
HTMLTest:OpenURL(“http://yahan.clark.googlepages.com/book1”)
end
concommand.Add( “book1”, Book )
[/lua]

How do I create an html panel that opens that url?

Um, like that? Bear in mind that only works on the client, so you have to add the concommand from the client. Also, HTML elements are just an HTML thing, they’re not a DFrame. They’re not draggable nor do they have close buttons, so that won’t work. I would recommend putting the html in DFrame.

[lua]
function Book( ply, cmd, args )
local HTMLFrame = vgui.Create(“DFrame”)
HTMLFrame:SetPos(50,50)
HTMLFrame:SetSize(500,500)
HTMLFrame:ShowCloseButton( true )

local HTMLTest = vgui.Create(“HTML”)
HTMLTest:SetPos(50,50)
HTMLTest:SetParent(HTMLFrame)
HTMLTest:SetSize(400,400)
HTMLTest:OpenURL(“http://yahan.clark.googlepages.com/book1”)
end
concommand.Add( “book1”, Book ) [/lua]

Just as a note you can set a parent like this: local HTMLTest = vgui.Create(“HTML”, HTMLFrame)

Saves a bit of typing especially if you have a lot of components to create.

And that code seems fine to me on a quick glance.

I think this is what you’re looking for (exactly):

[lua]function Book()
local frame = vgui.Create(“DFrame”)
frame:SetSize(ScrW() - 400, ScrH() - 400)
frame:Center()
frame:MakePopup()
frame:SetTitle(“Book 1”)
frame:ShowCloseButton(false)

local html = vgui.Create(“HTML”,frame)
html:SetPos(20,30)
html:SetSize(frame:GetWide()-40,frame:GetTall()-60)
html:OpenURL(“http://yahan.clark.googlepages.com/book1”)
end
concommand.Add( “book1”, Book)[/lua]