Insert a node in an existing tree, q howto

This is a forum focused on providing support for rTree

Moderators: heatherlaine, robinmiller, kevinmiller, wilstrand

Post Reply
Informatie
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 37
Joined: Fri Sep 09, 2011 10:04 am
Location: Netherlands

Insert a node in an existing tree, q howto

Post by Informatie » Mon Nov 26, 2012 6:44 pm

I have created a tree with several nodes. Display fine.
ROOT
node1
subnode 1-1
subnode 1-2
subnode 1-3
node2
node3

I want to insert a node between subnode 1-2 en subnode 1-3 without rebuilding the tree.
As I understand it right now new_node is adding at the end.
I tried creating node with lastnod_id + 1000 , and then create a node in between.
hilitedNodeIDs doesn't help . NextId and currentid would help.

Who has more ideas's

command buildtree
local sNodeId, sNodeIds, sDepthA
lock screen
dispatch "delete_nodeData" to control "Tree"
set the treeType of control "Tree" to empty
add 1000 to sNodeId
put sNodeId & cr after sNodeIds
put 0 into sDepthA[sNodeId]
---- level 1
add 1000 to sNodeId
put sNodeId & cr after sNodeIds
put 1 into sDepthA[sNodeId]
add 1000 to sNodeId
put sNodeId & cr after sNodeIds
put 1 into sDepthA[sNodeId]
---
delete character - 1 of sNodeIds
set the NodeIds of control "Tree" to sNodeIds
set the custompropertyset of control "Tree" to "depth_of_node_ID_"
set the custompropertyset of control "Tree" to sDepthA
set the custompropertyset of control "Tree" to empty
dispatch "renderTree" to control "Tree"
unlock screen
end buildtree

command InsertNode
local sNodeId, sNodeIds, sDepthA
lock screen
---- level 1
add 1500 to sNodeId
put sNodeId & cr after sNodeIds
put 2 into sDepthA[sNodeId]
dispatch "renderTree" to control "Tree"
unlock screen
end InsertNode

Post Reply

Return to “rTree”