Derma selecting

[lua]
local DermaListView = vgui.Create(“DListView”)
DermaListView:SetParent( DermaPanel )
DermaListView:SetPos( 20, 50)
DermaListView:SetSize( 115 , 90)
DermaListView:SetMultiSelect(false)
DermaListView:AddColumn(“Owners”)

DermaListView:AddLine(“Test1”)
DermaListView:AddLine(“Test2”)
DermaListView:AddLine(“Test3”)
[/lua]

Its me again and as you can see i have a list with a column in this snip of code pretty much.
And under it i have test1,test,etc.
How could i make it so a player could select one of the options and follow up with running a command?

ex: Click on test1 and it opens a link.

As specified on the wiki page for the DLIstView control, there is a **[DListView.OnRowSelected

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=DListView.OnRowSelected)** method. In your case, you would do:

[lua]DermaListView.OnRowSelected = function( self, line )
gui.OpenURL( DermaListView:GetLine( line ):GetValue( 1 ) )
end[/lua]

That is, if the first column contains the URL. If you don’t want to display the URL with the entry, you can do something like this:

[lua]DermaListView:AddLine(“Test1”).URL = “http://www.test1.com
DermaListView:AddLine(“Test2”).URL = “http://www.test2.com
DermaListView:AddLine(“Test3”).URL = “http://www.test3.com

DermaListView.OnRowSelected = function( self, line )
gui.OpenURL( DermaListView:GetLine( line ).URL )
end[/lua]

thanks. it works.