You propose a recursive procedure
procedure loadchildren(anode: <tchildnode>);
Then while <..> loop must be deleted and replaced with (if not end of data)
is'nt it?
Regards.
________________________________
De : Martin Schreiber <[email protected]>
Envoyé : samedi 28 juillet 2018 16:20
À : [email protected]
Objet : Re: [MSEide-MSEgui-talk] treeitemedit
On Saturday 28 July 2018 17:33:06 mohamed hamza wrote:
> Hi Martin,
>
> I read msedatanodes.pas to find any method to give current node in the
> tree without success.
>
What is the "current node"?
>
> I tried
>
> grid.rowcount:=1;
> node:=tmynode(treeedit[0]);
> tmynode(treeedit[0]).caption:='ROOT';
>
> current:=node.add(tmynode);
> current.caption:='A1.'+inttostr(current.treelevel);
> node:=current.add(tmynode);
> node.caption:='A2.'+inttostr(node.treelevel);
>
> In that way I got the tree:
>
> +ROOT
>
> +A1.1
>
> A2.2
> Is there a simplest way?
Possible pseudo code:
procedure loadchildren(anode: <tchildnode>);
var
node1: <tchildnode>
begin
while there is data for children do begin
node1:= <tchildnode.create>
load node1 properties from data
loadchildren(node1);
anode.add(node1);
end;
end;
begin
rootnode:= <therootnode>.create;
loadchildren(rootnode);
<treeedit>.itemlist.add(rootnode);
[...]
> I tried with addchildren ( current.addchildren(
> tmynode) no success.
>
node1.addchildren(<node2>) transfers the children of <node2> to <node1>
> the problem gets more complicated when I used addchildren to specific node
> because it is in a previous level ?
>
> for example :
>
> before doing c.addchildren(b) do I have to search the parent
>
> while .......
> node:=node.parent;
>
I don't think so. What do you want to achieve?
Martin
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk