DScrollPanel won't instantiate

Hi everybody,

I wonder why my DScrollPanel is not correct ?


local PANEL = {}

function PANEL:Init()
  self:Dock( FILL )

  self.VBar.Paint = function( pnl, w, h )
    draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 255 ) )
  end

  self.VBar.btnUp.Paint = function( pnl, w, h )
    draw.RoundedBox( 0, 0, 0, w, h, Color( 200, 100, 0 ) )
  end

  self.VBar.btnDown.Paint = function( pnl, w, h )
    draw.RoundedBox( 0, 0, 0, w, h, Color( 200, 100, 0 ) )
  end

  self.VBar.btnGrip.Paint = function( pnl, w, h )
    draw.RoundedBox( 0, 0, 0, w, h, Color( 100, 200, 0 ) )
  end


  for i=0, 100 do
  	local DLabel = self:Add( "DButton" )
  	DLabel:SetText( "Button #" .. i )
  	DLabel:Dock( TOP )
  	DLabel:DockMargin( 0, 0, 0, 5 )
  end

  print("End init scroll")
end

vgui.Register( "RICKY_ScrollPanel", PANEL, "DScrollPanel")

It throws


Warning: vgui.Create failed to create the VGUI component (RICKY_ScrollPanel)

Thanks in advance !

Are you actually running the code to register your panel? At first glance it seems OK so that’s the only possible issue I can see with this.

Yes i registered it as you can see in my code,


vgui.Register( "RICKY_ScrollPanel", PANEL, "DScrollPanel")

EDIT : I removed function by function and now its works with the same code, i don’t really understand…

Thanks anyway !