Painting and retrieve data from DListView?

Hey everyone.

I’m working with DListView, but I’ve encountered some problems.

  1. I cannot seem to figure out how to target individual elements of the DListView to paint them.

  2. Reading the wiki, I couldn’t find any way to retrieve the data from a row that is selected.

Any help with either of these conundrums is greatly appreciated :smiley:

  • FP
  1. To target the individual elements to paint it’s a bit trickier, but I think you could do it by looping through list.Lines and list.Columns and overriding the paint functions of each of the panels in those tables
  2. You just need to use

DListView:OnRowSelected and then do row:GetValue( 1 )

Could I do it with double clicks instead of single click selections?

:snip: automerge

[editline]30th July 2016[/editline]

I think if you use

DListView:DoDoubleClick and do line:GetValue(1) then it should work

[editline]30th July 2016[/editline]

Actually I’m not sure- but the code for the DListView’s lines is here- GetValue seems to work on it from what I can tell

Here, from my scoreboard tutorial on how to target any specific element:

	--[[ Line painting ]]--
for _, v in pairs ( player.GetAll() ) do
	local line = playerlist:AddLine( v:Name(), v:Frags(), v:Deaths(), v:Ping() )
	function line:Paint( w, h )
		--Paint the LINEs here

	--[[ Column header painting ]]--
for _, v in pairs( playerlist.Columns ) do
	function v.Header:Paint( w, h )
		-- Paint the HEADERs here
	v.Header:SetTextColor( Color( 255, 255, 255, 0 ) ) -- Set its text alpha with this incase you paint the text manually

playerlist. – Its the panel name of the DListView. Full reference:

Elements of the DListView can be found here: