DListView.GetSelectedLine

From GMod Wiki

Jump to: navigation, search
Function
Syntax DListView:GetSelectedLine( )
Description:
Gets the first selected line.
Returns: number
In Object: DListView
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=DListView.GetSelectedLine]DListView.GetSelectedLine [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

 
DermaListView = vgui.Create( "DListView" , DermaPanel ) -- Makes a list and parents to the panel
-- assuming you already have a panel...
DermaListView:SetSize( 100, 200 )
DermaListView:SetPos( 10, 15 ) -- Both are straight forward
DermaListView:AddColumn( "Name" ) -- Adds a column titled "Name"
 
for k, v in pairs( player.GetAll() ) -- Get's all the players and puts them into a loop
DermaListView:AddLine( v.Name() ) -- Adds a line per player
end
 
DermaButton = vgui.Create( "DButton", DermaPanel ) -- Makes a button and parents to the panel
DermaButton:SetPos( 60, 250 )
DermaButton:SetSize( 50, 25 )
DermaButton.DoClick = function()
print(DermaListView:GetSelected) -- Prints what line that is selected when button is pressed
end
 
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox