Woo, weird visual artifacts with custom DPanels!!

In the top left corner, that weird-looking thing behind the window’s text.

I don’t understand why it’s doing this, the code for the panel is pretty much just to draw a rectangle rather than a window.

[lua]
local PANEL = {}

function PANEL:Paint(w,h)
surface.SetDrawColor(Color(90,90,90,200))
surface.DrawRect( 0,0,w,h )
end

vgui.Register(“ike_DFrame”,PANEL,“DFrame”)
[/lua]

Any idea what it is or how to fix it?

EDIT: I said DPanel rather than DFrame. The element’s base is a DFrame.

SOLVED: I had to derive from EditablePanel instead of DFrame.

Try to put this at the beginning of the PAINT function
[lua]surface.SetTexture()[/lua]

Bad argument #1, number expected, got nil. With a number it has the same artifact, no error.

Edit: The artifact is clickable, like some kind of button maybe, but I disabled close buttons by default.

Can you post your full code? This can happen for several different reasons. I’ve seen positioning be reset because MakePopup was called on a parent element and a child element.; among other things.

draw.NoTexture() or something

[lua]
local FACTIONREQPANEL = {}

function FACTIONREQPANEL:Init()
ike.ply.charcreate_faction = “Citizen”
draw.NoTexture()
self:SetSize(400,200)
self:Center()
self:SetBackgroundBlur(true)
self:SetDraggable(false)
self:SetTitle(“Choose Faction”)
self:ShowCloseButton(false)
self:SetParent(ike.gui.menu)
self:MakePopup()

self.FactionSelect = self:Add("DComboBox")
self.FactionSelect:SetSize( 150, 20 )
self.FactionSelect:SetValue( "Citizen" )
self.FactionSelect:Center()

local factions = {'Citizen','Cop'}
for i,v in ipairs(factions) do
	self.FactionSelect:AddChoice( v )
end
self.FactionSelect.OnSelect = function( panel, index, value, data )
	ike.ply.charcreate_faction = data
end

self.ConfirmBtn = self:Add("ike_button")
self.ConfirmBtn:SetText("Continue")
self.ConfirmBtn:SetSize(50,20)
self.ConfirmBtn:SetPos(175,175)
self.ConfirmBtn.DoClick = function()
	vgui.Create("ike_NewChar")
	self:Remove()
end

self.CancelBtn = self:Add("ike_button")
self.CancelBtn:SetText("Cancel")
self.CancelBtn:SetSize(50,20)
self.CancelBtn:SetPos(175,150)
self.CancelBtn.DoClick = function()
	self:Remove()
end

end

vgui.Register(“ike_InitNewChar”,FACTIONREQPANEL,“ike_DFrame”)
[/lua]

The code for ike_DFrame is in the OP.

it’s probably the label and the close button and all that from the dframe, derive from dpanel instead

I need to derive from DFrame because it derives from EditablePanel, and I disabled the close button. The label is there, as well, just infront of the artifact. I suppose I could try deriving from EditablePanel directly, though.