Hello, I'm creating a [URL="http://wiki.garrysmod.com/page/VGUI/Elements/DListView"]DListView[/URL] which will display all the players on the server.
I'm wanting to set this up so that the columns of [URL="http://wiki.garrysmod.com/page/VGUI/Elements/DListViewLine"]DListViewLine[/URL] for each player is updated whenever their intended value is changed. (Like when a player changes the name, or their ping changes.)
I decided to go about doing this by looping through the online players inside a [URL="http://wiki.garrysmod.com/page/GM/Think"]Think hook[/URL]. If a player does not currently have a panel associated with them, we'll want to create a new DListViewLine for them.
However, for some reason whenever a new line is created; it is not shown in the DListView. When I remove the associated panel check, the new lines are being put into the DListView hundreds of times (As is expected to happen).
I decided to add some debug print code to see if if the lines are even trying to be created. As shown below, the lines appear to be being created.
Does anybody know why these lines are not appearing in the DListView when my associated panel check is there?
My code: [URL="http://pastebin.com/arFLDR10"]http://pastebin.com/arFLDR10[/URL]
Debug Print Output:[QUOTE]Panel Created for [BBB] Sir. Braden1996 Panel: [name:Panel][class:Panel][0,0,64,24]
Panel Created for Bot31 Panel: [name:Panel][class:Panel][0,0,64,24]
Panel Created for Bot32 Panel: [name:Panel][class:Panel][0,0,64,24]
Panel Created for Bot33 Panel: [name:Panel][class:Panel][0,0,64,24]
Panel Created for Bot34 Panel: [name:Panel][class:Panel][0,0,64,24]
Panel Created for Bot35 Panel: [name:Panel][class:Panel][0,0,64,24]
Panel Created for Bot36 Panel: [name:Panel][class:Panel][0,0,64,24]
Panel Created for Bot37 Panel: [name:Panel][class:Panel][0,0,64,24]
Panel Created for Bot38 Panel: [name:Panel][class:Panel][0,0,64,24]
Panel Created for Bot39 Panel: [name:Panel][class:Panel][0,0,64,24]
Panel Created for Bot40 Panel: [name:Panel][class:Panel][0,0,64,24]
Panel Created for Bot41 Panel: [name:Panel][class:Panel][0,0,64,24]
Panel Created for Bot42 Panel: [name:Panel][class:Panel][0,0,64,24]
Panel Created for Bot43 Panel: [name:Panel][class:Panel][0,0,64,24]
Panel Created for Bot44 Panel: [name:Panel][class:Panel][0,0,64,24]
[/QUOTE]
(The above is printed, yet there are no lines being put into the DListView)
try this
[code]
newLine.Columns[2].Think = function(slf)
local p = slf.player;
if IsValid(p) then
if (p:Nick() != slf:GetValue(2)) then
slf:SetColumnText(2, p:Nick());
end
end
end
[/code]
[QUOTE=G4MB!T;45216107]try this
[code]
newLine.Columns[2].Think = function(slf)
local p = slf.player;
if IsValid(p) then
if (p:Nick() != slf:GetValue(2)) then
slf:SetColumnText(2, p:Nick());
end
end
end
[/code][/QUOTE]
Thank you for your reply, but it sadly didn't help the issue. The problem was that the rows in the DListView weren't being created. I have managed to solve it - but still have no idea how the previous attempt didn't work. To solve the issue, I simply used 'self.usersList:Think()' instead of 'PANEL:Think()' and obviously changed what needed to be changed :)
Sorry, you need to Log In to post a reply to this thread.