On Sun, Jan 27, 2013 at 12:28 PM, Mukenx <mukenx@gmail.com> wrote:
to add a node at a certain nesting level to a tree, the tree view add() method states that the nesting level corresponds to the number of leading commata.

for a given nesting level n (determined at runtime) for a node to be appended to the tree, is there another way of adding the node than using INTERPRET?

INTERPRET 'tc~add( ' || ","~copies(n) || ', "nodeText")'

Well the current samples\oodialog\controls\TreeView\treeViewCustomDraw.rex example program reads the lines from a file and has a method makeArgs() that converts the line into an argument array and then uses sendWith().  You could look at that and do something similar.

    do while lines(self~TREE_FILE)
        args = self~makeArgs(linein(self~TREE_FILE))
        tv~sendWith('add', args)
    end

You can also use the insert() method.

If you are inserting an arbitrary item, then I would use insert().  But it requires you know the parent of where you want to insert the item.

As I recall, you need to be careful using the add() method because it is semi-dependent on adding the items sequentially from the root.

Without a doubt you can do it without using interpret, just depends on how much work you want to put into it.

--
Mark Miesfeld