views:

191

answers:

2

Hello:

I have a treeview widget in my Tcl/Tk application that will often show duplicate records. I tried writting "lsort -unique" and "lrmdups" into my code to automatcally delete the treeview duplicates, but with no luck. If possible, does anyone know how to do this?

Thank you,

DFM

+1  A: 

If you are asking about the ttk::treeview widget that is provided with Tk 8.5 and above then one way to ensure unique entries is to be careful about the -id parameter. It will automatically prevent duplicate items with the same id:

% pack [ttk::treeview .tv -columns {One Two}] -fill both -expand 1
% .tv insert {} end -id id1 -text First -values {1st first}
id1
% .tv insert {} end -id id1 -text Second -values {2nd second}
Item id1 already exists
patthoyts
A: 

If you know the id of an item to delete, you can just do this:

.tv delete $id
Donal Fellows