nomad-software / tkd

GUI toolkit for the D programming language based on Tcl/Tk
MIT License
117 stars 16 forks source link

Delete rows from TreeView #32

Closed TheGag96 closed 8 years ago

TheGag96 commented 8 years ago

It doesn't appear that there is any way to delete individual rows from a TreeView barring deleting them all with deleteRows(). Calling destroy() on TreeViewRow does nothing. I thought then maybe I could do it the incredibly inefficient way and get all rows, delete them all from the tree, build a new list of rows (checking manually as to not add ones I want to remove), then adding that new list back. The thing is, I can't even do that because there's no way to get the list of all rows! Is the functionality really that incomplete, or am I missing something here?

nomad-software commented 8 years ago

The treeview widget was rushed so only the bare minimum of functionality exists. With that said it should be possible to do what you want by thinking a little differently.

The widget should be seen as a view for your data and not a storage facility for it. In other words maintain a list of rows in your application and add and remove from that list, then when presenting the data to the user, clear and re-add the rows to the widget. I agree this won't scale if you are using thousands of rows but until a new API for this widget is in place that is the solution.

TheGag96 commented 8 years ago

Yeah, I figured something like that might be what I need to do. It's painful, but it'll work!

Also, something unrelated: MessageDialogs seem always make their message double up backslashes (\ -> \). I've tried every way I can think of to pass in the string (concatenating single backlash characters, dirSeparator, enclosing the quote in backticks). It looks like it's a problem either in the way you format the tcl/tk command string when calling _tk.eval() or maybe tcl/tk itself. Not sure.

nomad-software commented 8 years ago

I'll take a look.

nomad-software commented 8 years ago

Fixed in https://github.com/nomad-software/tkd/commit/fac8c5c4cf5ef1d9fb6137ef6ed5b5e994e82b4c. A new release has been created too. https://github.com/nomad-software/tkd/releases/tag/v1.1.5