• Find Vgui panels by panel type
    1 replies, posted
When using GetName() GetClassName() or anything similar on a panel all I receive is an ambiguous "Panel" or "Label". Is there a way to find a panel by it's panel type or derma control name, such as "DFrame" or something similar? I'm trying to use this to identify and remove parts of the spawn menu, so I may just be trying to identify something that isn't what I think it is. Looking through the spawn menu code, all of the elements of the spawn menu use vgui elements such as "ContentIcon" and "ContentContainer". So how would I identify a panel in such a way as to return those naming schemes? Heres what I'm basically forced to use without this solution (doesn't actually work, still WIP btw): [lua]local testspawnmenu = vgui.Create( "SpawnMenu" ) for k, v in pairs(testspawnmenu:GetChildren()) do for ktwo ,vtwo in pairs(v:GetChildren()) do for kthree, vthree in pairs(vtwo:GetChildren()) do vthree:Remove() hook.Run("SpawnlistContentChanged", vthree) end end end[/lua] Using the above code I also get this error: [code][ERROR] lua/skins/default.lua:525: Tried to use invalid object (type Panel) (Object was NULL or not of the right type) 1. GetTall - [C]:-1 2. unknown - lua/skins/default.lua:525 [/code] Any help with either of these problems would be much appreciated.
panel.ClassName [editline]28th March 2013[/editline] The reason you're getting that error is you're using vthree in hook.Run, but you removed it on the line above.
Sorry, you need to Log In to post a reply to this thread.