DListView.OnRowRightClick

From GMod Wiki

Jump to: navigation, search
Derma Control: DListView
Parent Class:DListView
Subclasses:None
Description:
Does the same as DListView.OnClickLine but with right click.

Example

DescriptionRaises an event when right clicked on a row.
Used onNewerClient.png
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
 
OutputPrints the players SteamID into your console.
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox