Garry's Mod Wiki

DListView:OnRowSelected

DListView:OnRowSelected( number rowIndex, Panel row )

Description

Called internally by DListView:OnClickLine when a line is selected. This is the function you should override to define the behavior when a line is selected.

Arguments

1 number rowIndex
The index of the row/line that the user clicked on.
2 Panel row
The DListView_Line that the user clicked on.

Example

Prints the first two column values of the row that was clicked. In this example it's the nickname and kills of the player selected in the list

local frame = vgui.Create( "DFrame" ) frame:SetSize( 300, 300 ) frame:MakePopup() local listView = frame:Add( "DListView" ) listView:Dock( FILL ) listView:AddColumn( "Nick" ) listView:AddColumn( "Frags" ) for _, v in pairs( player.GetAll() ) do listView:AddLine( v:Nick(), v:Frags() ) end listView.OnRowSelected = function( panel, rowIndex, row ) print( row:GetValue( 1 ) ) print( row:GetValue( 2 ) ) end

Page Links


Special Pages


Wikis

?

Render Time: 41ms

Session 0
DB GetPage 2
Generate Html 9
SaveChanges 15
Render Body 0
Render Sidebar 12