ttk treeview widget: how to tell if an item is detached



Is there a way to tell if an item is detached? For use of detach:

manual of ttk::treeview(3tk)

pathname detach itemList
Unlinks all of the specified items in itemList from the tree.
The items and all of their descendants are still present and may
be reinserted at another point in the tree but will not be dis‐
played. The root item may not be detached. See also: delete.

I first tried


$treeview exists item

and found it returns true for both detached items and regular items.

Then I tried

$treeview parent item

Realized detached item always returns empty string {}, but then, regular
items who are direct children of root item also returns empty string,
thus not distinguished.

Then I tried

$treeview index item

hoping detached item returns some special value. It returns zero. But
since index start from zero, the first children item also returns zero,
thus not distinguished.

Of course I tried to google and look up tcl.tk wiki pages before all
these studies. So it seems I did pretty much home work and had to left
this to the wisdom of usenet.

As a last resort, I can always keep a variable to hold list of detached
items the moment I detach them, but then it's not very good programming,
because then the program who uses the widget knows a bit too much how
the widget works.

Thanks in advance!
.



Relevant Pages

  • Re: ithreads & memory
    ... > after the detach also stops it gathering memory. ... so its refcount can't go to zero until it finishes). ... because there is always some other thread holding a reference to this one. ...
    (comp.lang.perl.misc)
  • Re: ttk treeview widget: how to tell if an item is detached
    ... For use of detach: ... $treeview exists item ... and found it returns true for both detached items and regular items. ... Realized detached item always returns empty string, but then, regular ...
    (comp.lang.tcl)
  • Re: ttk treeview widget: how to tell if an item is detached
    ... An method like elide in text widget would work well for me too. ... it is perhaps better than detach, because it makes tcl/ttk easier to ...
    (comp.lang.tcl)