Hi Liverpole,

I could post code, but sometimes it causes one to miss the forest because of the trees. Lets start with concepts, then I can post code if needed.

Lets consider the algorithm needed given the methods of an hlist to move a node, with all its children, before another node. So lets say that I have

n1 n1.c1 n1.c2 n2 n2.c1 n2.c2

and I want to move n2 and all its children, before n1.

It seems that all I can do is either 'add' and item to the hlist, or delete it, and all its children if there are any.

It would then seem that I would need to delete n2 and hence all its children, then re-create n2, specifying its location in the hlist::add method, so that it is before n1. I could then re-create all its children, simply specifying the entrypath.

This is hugely wasteful. Especially if the deleted node had many descendants.

It seems that the hlist has good methods for the initial creation of a tree, but once created, re-distributing nodes seems painful.

What am I missing?

..Otto


In reply to Re^2: Tk::Hlist item movement by otto
in thread Tk::Hlist item movement by otto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.