Code | -- The DFrame
panel = vgui.Create("DFrame")
panel:SetSize( 500, 300 )
panel:SetTitle( "DListView Example" )
panel:Center()
panel:MakePopup()
-- The DListView
Listview = vgui.Create("DListView")
Listview:SetParent( panel )
Listview:SetPos( 20, 30 )
Listview:SetSize( 450, 250 )
Listview:AddColumn( "Player" )
Listview:AddColumn( "SteamID" )
Listview.OnRowSelected = function( panel, line )
print( Listview:GetLine(line):GetValue(2) ) -- Print in console the right clicked lines players steamid.
end
for k,v in pairs( player.GetAll() ) do
Listview:AddLine( v:Nick() , v:SteamID() ) -- Do a loop around the players and add each player to the listview.
end
|