Entity Spawn help

Ok, how do I use VGUI to spawn an entity (properly) with its animations on do click events?


AddCSLuaFile()
local Props = {}
local MenuName = "Server Spawns"
Props[1] = "models/props_borealis/bluebarrel001.mdl"

spawnmenu.AddCreationTab( MenuName, function()

    local proplist = vgui.Create( "DIconLayout" )
    proplist:SetPos( 100, 100 )
	
	for k,v in pairs( Props ) do
	local icon = vgui.Create( "SpawnIcon", proplist )
	icon:SetModel( v[1] )
	proplist:Add( icon )
	
	icon.DoClick = function(icon)
	   PrintMessage( HUD_PRINTTALK, "Who knows.." )
	end
	
	end


end, "icon16/bricks.png", 200 )


I figured out how to add a new tab to the Q menu, and it works. But how do I make a list of items just like Spawnlists tab does? I need help finding a way, to Populate the menu?

[editline]1st September 2016[/editline]

Oh and I want to do it like the SPAWNLIST does

Ok, but look at this: ( I just remade it )


AddCSLuaFile()
local Props = {}
Props[1] = "models/props/barrel.mdl"
local tabName  = "Server Spawns"                -- change this to what you want the tab to be named
local tabIcon  = "icon16/bricks.png"                -- the icon image of the tab
local hookName = "PopulateCustomGamemodeEntities"   -- this is the hook that gets called to populate the tab, you can rename it to whatever

hook.Add( hookName, "AddEntityContent", function( contentPanel, tree, node )
    
	local contents = {}


	-- Props
	table.insert( contents, {
		type = "header",
		text = "Props"
	} )
	table.insert( contents, {
		type = "model",
		model = "models/props_c17/oildrum001.mdl"
	} )
	table.insert( contents, {
		type = "model",
		model = "models/props_wasteland/cargo_container01.mdl",
		skin = 1,
		wide = 128,
		tall = 64
	} )

	-- Entities
	table.insert( contents, {
		type = "header",
		text = "Entities"
	} )
	table.insert( contents, {
		type = "entity",
		spawnname = "sent_ball",
		nicename = "Bouncy Ball",
		material = "entities/sent_ball.png"
	} )
	table.insert( contents, {
		type = "entity",
		spawnname = "combine_mine",
		nicename = "Hopper Mine",
		material = "entities/combine_mine.png"
	} )

	-- Vehicles
	table.insert( contents, {
		type = "header",
		text = "Vehicles"
	} )
	table.insert( contents, {
		type = "vehicle",
		spawnname = "Airboat",
		nicename = "Half-Life 2 Airboat",
		material = "entities/Airboat.png"
	} )
	table.insert( contents, {
		type = "vehicle",
		spawnname = "Chair_Office2",
		nicename = "Executive's Chair",
		material = "entities/Chair_Office2.png"
	} )

	-- NPCs
	table.insert( contents, {
		type = "header",
		text = "NPCs"
	} )
	table.insert( contents, {
		type = "npc",
		spawnname = "npc_citizen",
		nicename = "A random citizen",
		material = "entities/npc_citizen.png",
		weapon = { "weapon_smg1", "weapon_crowbar" }

	} )
	table.insert( contents, {
		type = "npc",
		spawnname = "npc_headcrab",
		nicename = "Headhumper",
		material = "entities/npc_headcrab.png"
	} )

	-- Weapons
	table.insert( contents, {
		type = "header",
		text = "Weapons"
	} )
	table.insert( contents, {
		type = "weapon",
		spawnname = "weapon_crowbar",
		nicename = "Crowbar",
		material = "entities/weapon_crowbar.png",
	} )
	table.insert( contents, {
		type = "weapon",
		spawnname = "weapon_smg1",
		nicename = "SMG",
		material = "entities/weapon_smg1.png",
	} )

	spawnmenu.AddPropCategory( hookName, "Two of each type", contents, "icon16/box.png" )

end )

spawnmenu.AddCreationTab( tabName, function()

    local ctrl = vgui.Create( "SpawnmenuContentPanel" )
    ctrl:CallPopulateHook( hookName )

    return ctrl

end, tabIcon, 20 )

It shows up, good. I click on it, it opens a side panel. It dosent show entities? Why is this? I want to litterally add props on the page. BUt it wont work ?!

How would I add props?

[editline]1st September 2016[/editline]

I know how to use VGUI but i dont know how to parent it to the Spawnmenu
?

:zoid: Please help
snip

Please help… -snip- x2