Derma Spawnicons?

How would i go about making a derma menu that when you press a icon it spawns a entity? I tried editing the GMod wiki on spawn icons but it didn’t work out very well. Could someone could give me a example of how do this or point me in the right direction?

Link to the wiki i tried to edit http://wiki.garrysmod.com/?title=Using_SpawnIcons

if your making a gamemode you need to derive sandbox

um, no?

Fun thing, im actually coding a backpack at the moment.



local function CreateIcon( model, index, Type, Classtype )
	local Icon = vgui.Create("SpawnIcon",List)
		Icon:SetIconSize( 64 )
		Icon:SetModel( model )
		Icon.DoClick = function()
			RunConsoleCommand( "gm_spawn", model ) //Make the prop
		end
	List:AddItem( Icon ) // this adds the icon to the DPanelList
end