Jump to content

Josh's Lua GUI ListView


Rick
 Share

Recommended Posts

Has anyone used Josh's Lua GUI? I'm looking at the ListView control and it hurts my mind trying to understand the way he structured it. The view has a line table, which has a column table (I'm good at this point), which columns have a linetext table? Not following the reasoning with that as the linetext table seems to store text in all columns. I would think you'd just have text for each column for that line and not a table of text for every line inside the column table.

 

Anyway, I'm trying to make a method to delete a specific line if the column has a certain value. I can get it to delete (sort of), but the deleted line still has an alt color and I can select it. When I return the lines table count of the view it only says 1 so not sure what's up.

 

This is probably a long shot but it's really bugging me.

 

My code

function ListView:RemoveLine(column, value)
-- loop through lines checking to find a value to match in the column param
local id = -1
for k, v in pairs(self.lines) do
	if v:GetColumnText(column) == value then
		id = v.id

		-- loop through columns in this line and delete them
		for index, value in ipairs(v.columns) do 
			table.remove(value.linetext, id)
			--value.linetext = {}
		end
	end
end

-- remove the line also
if id ~= -1 then
	table.remove(self.lines, id)
end
end

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...