DListView.DoDoubleClick

Hello! Now, I’m trying to create a menu for a donation addon I’m working on, and for some reason, my lists are not behaving with the DoDoubleClick function.

Here’s the entirety of my code pertaining to dmlist:


local dmlist = vgui.Create( "DListView", daframe )
dmlist:SetSize( 104, dmopanel:GetTall() )
dmlist:AlignTop( 6 + barSize )
dmlist:SetPos( 6, barSize + 6 )
dmlist:SetMultiSelect( false )
dmlist:AddColumn( "Models" )

dmlist.OnClickLine = function(parent, line, isselected)
	local name = line:GetValue(1)
	dmpanel:SetModel( findtable( name ).model )
	dmlabel1:SetText( name )
	dmlabel3:SetText( "Double click table entry to purchase for " .. findtable( name ).price .. " points" )
	function dmpanel.Entity:GetPlayerColor() return LocalPlayer():GetPlayerColor() end
end

dmlist.DoDoubleClick = function( lineID, line )
	print( "feedback" )
	net.Start( "donations_receive" )
		net.WriteString( "buymodel" )
		net.WriteFloat( lineID )
	net.SendToServer()
end

I also tried formatting my DoDoubleClick like it is on the wiki, as such:


function dmlist:DoDoubleClick( lineID, line )
	print( "feedback" )
	net.Start( "donations_receive" )
		net.WriteString( "buymodel" )
		net.WriteFloat( lineID )
	net.SendToServer()
end

Neither worked. Any ideas as to why?

i don’t know how or why it’s not working, but i do have a tip for you:
the function will behave differently depending if you define it with a . or :
i’ll use this horrible example i quickly faggoted up
[lua]
local tbl = {}
local tbl.things = 1

– .
– THIS WILL PREDUCE AN ERROR (self is nil)
function tbl.getThing()
return self.things
end

– :
– returns 1 (first argument (self) is automatically passed as the table youre calling the function on)
function tbl:getThing()
return self.things
end
[/lua]
you don’t use the panel itself; however, the arguments are fixed as in the first argument is always the panel itself, so it will most likely error

in this case, DoDoubleClick might actually be broke in of itself, but i don’t know as i don’t use it myself

After much debugging, I discovered that my problem was that because I was overwriting the OnClickLine function, it rendered DoDoubleClick nil. I’m now using OnRowSelected for that function, and DoDoubleClick is working.