I appologies for having to post this type of topic, but I seriously don’t know how to make this code working.
For the context, you have DFrame in which you want to add DListBox which lists all cop-folders of a player. Server side there’s no problems. The error is happening client side, when adding elements to the DListBox. I have overwritten the function AddItem of DListBox, so I could add custom code when user selects an element in this list.
Here is the code :
//actionsPanel is declared as file local. actionsPanel = vgui.Create('DListBox', mainFrame) actionsPanel:SetSize(208, 258) actionsPanel:SetPos(408, 29) actionsPanel:SetMultiple(false) actionsPanel.AddItem = function(strLabel) //Error here. local item = vgui.Create( "DListBoxItem", actionsPanel ) item:SetMother( actionsPanel ) item:SetText( strLabel ) --RRP Start item.DoClick = function() if (foundUser != nil) then LocalPlayer():ConCommand("rp_getfolderaction \"" .. foundUser .. "\" \"" .. strLabel .. "\"") end end --RRP End actionsPanel.DPanelList:AddItem( actionsPanel, item ) return item end
I get an error telling me strLabel is not a string but a panel. The most strange in this is that it’s not a panel, it’s an integer converted to string.