Garry's Mod Wiki

DListView

Description

A data view with rows and columns.

Parent

Derives from DPanel.

Example

Creates a DListView and populates it with two columns and three items, only one of which can be selected at a time.

Selecting a row will print a console message containing the text of the row and its index.

local f = vgui.Create( "DFrame" ) f:SetSize( 500, 500 ) f:Center() f:MakePopup() local AppList = vgui.Create( "DListView", f ) AppList:Dock( FILL ) AppList:SetMultiSelect( false ) AppList:AddColumn( "Application" ) AppList:AddColumn( "Size" ) AppList:AddLine( "PesterChum", "2mb" ) AppList:AddLine( "Lumitorch", "512kb" ) AppList:AddLine( "Troj-on", "661kb" ) AppList.OnRowSelected = function( lst, index, pnl ) print( "Selected " .. pnl:GetColumnText( 1 ) .. " ( " .. pnl:GetColumnText( 2 ) .. " ) at index " .. index ) end
Output: Selected Troj-on ( 661kb ) at index 3 Selected Lumitorch ( 512kb ) at index 2

Page Links


Special Pages


Wikis

?

Render Time: 46ms

DB GetPage 2
Generate Html 2
SaveChanges (1) 28
Render Body 0
Render Sidebar 12