Collapsed Catorgory doesn't open

http://img33.imageshack.us/img33/3341/2011120300002.th.jpg
http://img684.imageshack.us/img684/7999/2011120300001.th.jpg

here’s the whole code:
[lua]// Clientside only stuff goes here
function ShowTeamMenu()
local DermaPanel = vgui.Create( “DFrame” ) – Creates the frame itself
DermaPanel:SetPos( 80,80 ) – Position on the players screen
DermaPanel:SetSize( 600, 500 ) – Size of the frame
DermaPanel:SetTitle( “Main Menu” ) – Title of the frame
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( false ) – Draggable by mouse?
DermaPanel:ShowCloseButton( true ) – Show the close button?
DermaPanel:MakePopup() – Show the frame

local TestingPanel = vgui.Create( “DPanel”, DermaPanel )
TestingPanel:SetPos( 25, 50 )
TestingPanel:SetSize( 550, 50 )
TestingPanel.Paint = function() – Paint function
surface.SetDrawColor( 50, 50, 50, 255 ) – Set our rect color below us; we do this so you can see items added to this panel
surface.DrawRect( 0, 0, TestingPanel:GetWide(), TestingPanel:GetTall() ) – Draw the rect
surface.DrawText( “Message of the Day: Zyler Rocks!” )
end

local PropertySheet = vgui.Create( “DPropertySheet” )
PropertySheet:SetParent( DermaPanel )
PropertySheet:SetPos( 25, 110 )
PropertySheet:SetSize( 550, 315 )

local Welcome = vgui.Create( “DLabel” )
Welcome:SetText( “A” )
Welcome:SetColor(Color(191,255,0,255))
Welcome:SizeToContents()

local Character = vgui.Create( “DPanel” )
Character:SetSize( 305, 305 )
Character.paint = function()
surface.SetDrawColor(Color(191,255,0,255))
surface.DrawRect( 0, 0, TestingPanel:GetWide(), TestingPanel:GetTall() )
surface.DrawText( “Characters” )
end

local Props = vgui.Create( “DPanel” )
Props:SetSize( 305, 305 )
Props.paint = function()
surface.SetDrawColor(Color(191,255,0,255))
surface.DrawRect( 0, 0, TestingPanel:GetWide(), TestingPanel:GetTall() )
surface.DrawText( “Pick props to spawn” )
end

local food = {}

    food[1] = "models/props_junk/garbage_milkcarton002a.mdl"
food[2] = "models/props_junk/PopCan01a.mdl"
food[3] = "models/props_junk/garbage_takeoutcarton001a.mdl"
food[4] = "models/props_junk/watermelon01.mdl"
food[5] = "models/props_junk/garbage_metalcan001a.mdl"
food[6] = "models/props_lab/box01a.mdl"
food[7] = "models/props_lab/box01b.mdl"

local Proplist1 = vgui.Create(“DCollapsibleCategory”, Props)
Proplist1:SetPos(25, 50)
Proplist1:SetSize( 450, 50 ) – Keep the second number at 50
Proplist1:SetLabel( “Proplist1” )

Proplist1menu = vgui.Create(“DModelSelect”, Proplist1 )
Proplist1menu:SetSize( 300, 300 )
Proplist1menu:SetSpacing( 5 )
Proplist1menu:EnableHorizontal( true )
Proplist1menu:EnableVerticalScrollbar( false )
Proplist1menu:SetPadding( 4 )

for k,v in pairs(food) do
local icon = vgui.Create( “SpawnIcon”, Proplist1menu )
icon:SetModel( v )
Proplist1menu:AddItem( icon )
icon.DoClick = function( icon ) surface.PlaySound( “ui/buttonclickrelease.wav” ) RunConsoleCommand(“gm_spawn”, v)
end
end
Proplist1:SetContents(Proplist1menu)
PropertySheet:AddSheet( “Welcome”, Welcome, “gui/silkicons/user”, false, false, “Rules and stuff” )
PropertySheet:AddSheet( “Character/Groups”, Character, “gui/silkicons/group”, false, false, “Manage your character and groups” )
PropertySheet:AddSheet( “Props/Tools”, Props, “gui/silkicons/group”, false, false, “Get Props and Tools” )

local groupsnamesasdf = {}
groupsnamesasdf[1] = “Civil Service”
groupsnamesasdf[2] = “Government”
groupsnamesasdf[3] = “Employable”

local groupslist = vgui.Create(“DCollapsibleCategory”, Character)
groupslist:SetPos(25, 50)
groupslist:SetSize( 450, 45 ) – Keep the second number at 50
groupslist:SetLabel( “Groups” )

local group1 = vgui.Create(“DLabel”, groupslist)
group1:SetPos(20,20)
group1:SetColor(Color(255,255,255,255))
group1:SetFont(“default”)
group1:SetText(groupsnamesasdf[1])
group1:SizeToContents()

group1menu = vgui.Create(“DModelSelect”, groupslist )
group1menu:SetPos(40, 40)
group1menu:SetSize( 300, 300 )
group1menu:SetSpacing( 5 )
group1menu:EnableHorizontal( true )
group1menu:EnableVerticalScrollbar( false )
group1menu:SetPadding( 4 )

for _, pl in pairs( team.GetPlayers( 1 ) ) do – loop through all the players on TEAM_WHATEVER

local spawnicon = vgui.Create( "SpawnIcon", group1menu )
spawnicon:SetModel( pl:GetModel() ) -- get their model, set the spawnicon to it
spawnicon:SetTooltip( pl:Nick() ) -- "little yellow speech bubbles when you move your cursor over them"
group1menu:AddItem( spawnicon )

end
end

usermessage.Hook( “call_vgui”, ShowTeamMenu )[/lua]

the code in question:
[lua]local groupsnamesasdf = {}
groupsnamesasdf[1] = “Civil Service”
groupsnamesasdf[2] = “Government”
groupsnamesasdf[3] = “Employable”

local groupslist = vgui.Create(“DCollapsibleCategory”, Character)
groupslist:SetPos(25, 50)
groupslist:SetSize( 450, 45 ) – Keep the second number at 50
groupslist:SetLabel( “Groups” )

local group1 = vgui.Create(“DLabel”, groupslist)
group1:SetPos(20,20)
group1:SetColor(Color(255,255,255,255))
group1:SetFont(“default”)
group1:SetText(groupsnamesasdf[1])
group1:SizeToContents()

group1menu = vgui.Create(“DModelSelect”, groupslist )
group1menu:SetPos(40, 40)
group1menu:SetSize( 300, 300 )
group1menu:SetSpacing( 5 )
group1menu:EnableHorizontal( true )
group1menu:EnableVerticalScrollbar( false )
group1menu:SetPadding( 4 )

for _, pl in pairs( team.GetPlayers( 1 ) ) do – loop through all the players on TEAM_WHATEVER

local spawnicon = vgui.Create( "SpawnIcon", group1menu )
spawnicon:SetModel( pl:GetModel() ) -- get their model, set the spawnicon to it
spawnicon:SetTooltip( pl:Nick() ) -- "little yellow speech bubbles when you move your cursor over them"
group1menu:AddItem( spawnicon )

end
end[/lua]

[LUA]groupslist:SetSize( 450, 45 ) – Keep the second number at 50[/LUA] line 8 of questionable code.
Durrrr

That just affects the size of the Collapsible Catorgory before you open it. I’ve tried changing the value to different things and it makes no difference whether it is set to 50, 45 or even 150, except changing the actual size of the Catorgory before it is opened.

No matter what size I set it to it still doesn’t expand however

Then go to the wiki? lemme look at the code more

Edit: Is DModelSelect even a Derma control? last time i checked it wasn’t, or I at least didnt see it

It’s a panel of spawnicons.

I see
Edit: You could just use Spawnicons and a loop with a .DoClick function, thats the way i always do it and it works

Could I have an example?

like [LUA]
props = {}
props[1] = “Models/hurrdurr.mdl”
props[2] = “Models/hurrdurr2.mdl”

for k,v in pairs(props) do
icon = vgui.Create(“SpawnIcon”, <Parent Panel Here>)
icon:SetModel(v)
icon.DoClick = function() RunConsoleCommand(“gm_spawn”…v)
end
[/LUA]

something along those lines

tried this:
[lua] local groupslist = vgui.Create(“DCollapsibleCategory”, Character)
groupslist:SetPos(25, 50)
groupslist:SetSize( 450, 45 ) – Keep the second number at 50
groupslist:SetLabel( “Groups” )

local group1 = vgui.Create(“DLabel”, groupslist)
group1:SetPos(20,20)
group1:SetColor(Color(255,255,255,255))
group1:SetFont(“default”)
group1:SetText(groupsnamesasdf[1])
group1:SizeToContents()

for _, pl in pairs( team.GetPlayers( 1 ) ) do – loop through all the players on TEAM_WHATEVER

local spawnicon = vgui.Create( "SpawnIcon", groupslist )
spawnicon:SetModel( pl:GetModel() ) -- get their model, set the spawnicon to it
spawnicon:SetTooltip( pl:Nick() ) -- "little yellow speech bubbles when you move your cursor over them"
group1menu:AddItem( spawnicon )

end[/lua]

Didn’t work, got this:

http://img831.imageshack.us/img831/5544/2011120400001.th.jpg
http://img841.imageshack.us/img841/2833/2011120400002.th.jpg

Still doesn’t open :frowning:

idk then

You need groupslist:SetContents(group1menu) after your for loop.

no effect :(.

http://img440.imageshack.us/img440/6977/2011120900002.th.jpg
http://img805.imageshack.us/img805/48/2011120900001.th.jpg

I tried both inside (at the end of) and outside the loop:

[lua]// Clientside only stuff goes here
function ShowTeamMenu()
local DermaPanel = vgui.Create( “DFrame” ) – Creates the frame itself
DermaPanel:SetPos( 80,80 ) – Position on the players screen
DermaPanel:SetSize( 600, 500 ) – Size of the frame
DermaPanel:SetTitle( “Main Menu” ) – Title of the frame
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( false ) – Draggable by mouse?
DermaPanel:ShowCloseButton( true ) – Show the close button?
DermaPanel:MakePopup() – Show the frame

local TestingPanel = vgui.Create( “DPanel”, DermaPanel )
TestingPanel:SetPos( 25, 50 )
TestingPanel:SetSize( 550, 50 )
TestingPanel.Paint = function() – Paint function
surface.SetDrawColor( 50, 50, 50, 255 ) – Set our rect color below us; we do this so you can see items added to this panel
surface.DrawRect( 0, 0, TestingPanel:GetWide(), TestingPanel:GetTall() ) – Draw the rect
surface.DrawText( “Message of the Day: Zyler Rocks!” )
end

local PropertySheet = vgui.Create( “DPropertySheet” )
PropertySheet:SetParent( DermaPanel )
PropertySheet:SetPos( 25, 110 )
PropertySheet:SetSize( 550, 315 )

local Welcome = vgui.Create( “DLabel” )
Welcome:SetText( “A” )
Welcome:SetColor(Color(191,255,0,255))
Welcome:SizeToContents()

local Character = vgui.Create( “DPanel” )
Character:SetSize( 305, 305 )
Character.paint = function()
surface.SetDrawColor(Color(191,255,0,255))
surface.DrawRect( 0, 0, TestingPanel:GetWide(), TestingPanel:GetTall() )
surface.DrawText( “Characters” )
end

local Props = vgui.Create( “DPanel” )
Props:SetSize( 305, 305 )
Props.paint = function()
surface.SetDrawColor(Color(191,255,0,255))
surface.DrawRect( 0, 0, TestingPanel:GetWide(), TestingPanel:GetTall() )
surface.DrawText( “Pick props to spawn” )
end

local food = {}

    food[1] = "models/props_junk/garbage_milkcarton002a.mdl"
food[2] = "models/props_junk/PopCan01a.mdl"
food[3] = "models/props_junk/garbage_takeoutcarton001a.mdl"
food[4] = "models/props_junk/watermelon01.mdl"
food[5] = "models/props_junk/garbage_metalcan001a.mdl"
food[6] = "models/props_lab/box01a.mdl"
food[7] = "models/props_lab/box01b.mdl"

local Proplist1 = vgui.Create(“DCollapsibleCategory”, Props)
Proplist1:SetPos(25, 50)
Proplist1:SetSize( 450, 50 ) – Keep the second number at 50
Proplist1:SetLabel( “Proplist1” )

Proplist1menu = vgui.Create(“DModelSelect”, Proplist1 )
Proplist1menu:SetSize( 300, 300 )
Proplist1menu:SetSpacing( 5 )
Proplist1menu:EnableHorizontal( true )
Proplist1menu:EnableVerticalScrollbar( false )
Proplist1menu:SetPadding( 4 )

for k,v in pairs(food) do
local icon = vgui.Create( “SpawnIcon”, Proplist1menu )
icon:SetModel( v )
Proplist1menu:AddItem( icon )
icon.DoClick = function( icon ) surface.PlaySound( “ui/buttonclickrelease.wav” ) RunConsoleCommand(“gm_spawn”, v)
end
end
Proplist1:SetContents(Proplist1menu)
PropertySheet:AddSheet( “Welcome”, Welcome, “gui/silkicons/user”, false, false, “Rules and stuff” )
PropertySheet:AddSheet( “Character/Groups”, Character, “gui/silkicons/group”, false, false, “Manage your character and groups” )
PropertySheet:AddSheet( “Props/Tools”, Props, “gui/silkicons/group”, false, false, “Get Props and Tools” )

local groupsnamesasdf = {}
groupsnamesasdf[1] = “Civil Service”
groupsnamesasdf[2] = “Government”
groupsnamesasdf[3] = “Employable”

local groupslist = vgui.Create(“DCollapsibleCategory”, Character)
groupslist:SetPos(25, 50)
groupslist:SetSize( 450, 45 ) – Keep the second number at 50
groupslist:SetLabel( “Groups” )

local group1 = vgui.Create(“DLabel”, groupslist)
group1:SetPos(20,20)
group1:SetColor(Color(255,255,255,255))
group1:SetFont(“default”)
group1:SetText(groupsnamesasdf[1])
group1:SizeToContents()

for _, pl in pairs( team.GetPlayers( 1 ) ) do – loop through all the players on TEAM_WHATEVER

local spawnicon = vgui.Create( "SpawnIcon", groupslist )
spawnicon:SetModel( pl:GetModel() ) -- get their model, set the spawnicon to it
spawnicon:SetTooltip( pl:Nick() ) -- "little yellow speech bubbles when you move your cursor over them"
group1menu:AddItem( spawnicon )

end
groupslist:SetContents(group1menu)
end

usermessage.Hook( “call_vgui”, ShowTeamMenu )[/lua]

That works perfectly, you changed a lot of stuff around in your newer code when all you needed was to grouplist:SetContents(group1menu) in your old code.

works now, but nothing appears in the Collapsed Catorgory:

http://img846.imageshack.us/img846/4650/2011121000001.jpg

Uploaded with ImageShack.us

That would mean there are no players in team 1.

It sets the players team to team 1 in the server code, how would I make a user message that specifies this?

bump! It doesn’t have to be a user message

You don’t need a usermessage. There obviously are no players in team 1, change what it’s sorting through to player.GetAll() to verify.