Derma Panel Error & Problems

Warning: vgui.Create failed to create the VGUI component (DFrame)
[addons\bearsam1\lua\autorun\cl_init.lua:24] attempt to index local ‘DermaPanel’ (a nil value)

[LUA]local DermaPanel = vgui.Create( “DFrame” ) – Creates the frame itself
DermaPanel:SetPos( 50,50 ) – Position on the players screen
DermaPanel:SetSize( 1000, 900 ) – Size of the frame
DermaPanel:SetTitle( “Testing Derma Stuff” ) – Title of the frame
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true ) – Draggable by mouse?
DermaPanel:ShowCloseButton( true ) – Show the close button?
DermaPanel:MakePopup() – Show the frame
[/LUA]

We need the full code not only the snippet you suspect not work.

Thats it, their was a few lines of comments above it, line 24 is line 1 or 2.

Try fixing that, first.

Copy and paste typo from here to the forum, my bad didn’t see it. It is correct on my lua file however.

any other ideas?

Still give us the full code, since its not related to this part of the code it must be the rest of your code.

If you are not gonna post it please don’t ask for help.

Uhm? Its a bunch of lines for a previous program that are ALL commented, this is all that is not commented.

But since your stuck on that point.
[lua]
– if CLIENT then

– local frame = vgui.Create( “Frame”)
– frame:SetSize(200,200)
– frame:SetVisible( true )
– frame:SetPos(0,0)
– frame:SetName(“Lead4u’s ShoutCast Player”)
– frame:Label(“Lead4u’s ShoutCast Player!”)

– frame.Radio = vgui.Create( “HTML”,frame)
– frame.Radio:SetParent( frame )
– frame.Radio:SetPos(0,22)
– frame.Radio:OpenURL( “http://lead4u.org/kipi/SB/garrysmod/scast.html” )
– frame.Radio:StartAnimate( 10)
– frame.Radio:SetMouseInputEnabled( true )
– frame.Radio:SetSize(190,135)
– frame:SetVisible( true )
– frame:MakePopup()

– end

local DermaPanel = vgui.Create( “DFrame” ) – Creates the frame itself
DermaPanel:SetPos( 50,50 ) – Position on the players screen
DermaPanel:SetSize( 1000, 900 ) – Size of the frame
DermaPanel:SetTitle( “Testing Derma Stuff” ) – Title of the frame
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true ) – Draggable by mouse?
DermaPanel:ShowCloseButton( true ) – Show the close button?
DermaPanel:MakePopup() – Show the frame
[/lua]

Your code is probably running before all vguis have been registered…

You have to delay the creation of your frame using timer or a hook.

Spot on, thanks, interesting it doesn’t mention that in any of the beginners tutorials…

I realized when I was writing this that the above code wasn’t going to work out, and I tried using the same code and just adding the D in front, but that didn’t seem to work, thanks.

[editline]07:33PM[/editline]

Question #2: Is their a way to make my HTML panel background transparent? I have a circular object in a square box and It looks quite bad.

I do not believe HTML panels can be transparent. Pretty sure there’s always at least a white background.

Although maybe the new DHTML is different?

Do you know how to change its color then?

[editline]08:02PM[/editline]

Nvm found it!
function DermaPanel.Radio:Paint()
surface.SetDrawColor( 0, 0, 0, 255 )
surface.DrawRect( 0, 0, DermaPanel.Radio:GetWide(), DermaPanel.Radio:GetTall() )
end

That makes me very sad that you can’t touch html panels =(