Getting The Value From A DListView

I am wondering if there is a way to extract the Highlighted Data in a DPlayerList and set it to a value. I’m trying to take the highlighted name, AFTER a button is pressed, and output it into a different list. I have all the coding I need other than the code to assign a variable to the value of the highlighted code.

For example:


local BHMPlayerList = vgui.Create("DListView")
BHMPlayerList:AddColumn("Name")

local BHMBountyList = vgui.Create("DListView")
BHMBountyList:AddColumn("Job")
BHMBountyList:AddColumn("Target")
BHMBountyList:AddColumn("Payout")
BHMBountyList:AddColumn("Client")

BHMPlayerList:AddLine(“AB”)
BHMPlayerList:AddLine(“CD”)
BHMPlayerList:AddLine(“EF”)
BHMPlayerList:AddLine(“GH”)

And when you hit the button, it takes all data, assigns it to a variable and puts it into another list.

Other List:
BHMBountyList:AddLine(job, CD, amount, clientPlacingJob)****

DListView:GetValue() ?
I cant remember, and mau’s wiki is being dumb for me

[lua]

local mlist = maplist:GetLines()
for i=1, #mlist do
local things = maplist:GetLine(i)
print(tostring(things ))
print(tostring(things:GetValue(1)))
end[/lua]

>
Panel: 02D8D278
cs_assault
Panel: 02DA44F8
cs_compound
Panel: 02AEB738
cs_havana
Panel: 02D0A898
cs_italy
Panel: 02D42D58
cs_militia
Panel: 02D16378
cs_office

Thank you Freze

This seems like it would be good if I was trying to output the entire list, but I’m looking for the selected one only. Also it looks like someone would have to know what line is selected for it to be used singularly. Also it looks like the GetLine(x) code input has to be an integer, I’m going to be outputting Strings. I may be wrong, but it appears that it would output everything. Ill try Deadman’s suggestion in a few.

Edit: Just looked deeper into that wiki it appears I can do DListView.GetSelectedLine to get the line number then use that code to output its data. Is also apears to be the only way to get the data. Thanks for the help Freze.

When the wiki fails, those who are able to access it in these tough times for us wikimen… Must help eachother!

[lua]
PeopleListView.OnRowRightClick = function(self, lineID, line)
line:GetColumnText(Column number here)
end
[/lua] is what I use