@Allan: Thanks for the fine example. Well, I had to add a few things to make the refresh work, but it’s not too hard.
First of all, you should let Natural Studio know that the root node of your tree actually represents a built-in object (say a Program or what else). Otherwise the Refresh mechanics does not know that your tree node has something to do with the object currently being saved. I achieved this by changing the call to the Open method in ONCMD-N to
SEND ‘Open’ TO #MNATAUTOOBJECTTREES
WITH 30000 #TEKST-DYN #TEKST
6X 1009 ‘TESTCLS A1 101 99’
Obviously this works only if you incidentally have a Program TESTCLS in Library A1 on DBnr 99 and Fnr 101 open in the editor, but it should be sufficient to indicate the general approach. This has the nice side effect that Natural Studio treats this node as a Program in any respect, means it shows the right icon and context menu.
Second, I respond to the REFRESH notification in ONNFY-N simply with 1 and do nothing else.
IF NOTIFICATION = NOTIFY-REFRESH
RESULT := 1
Third, it is safer to use the original method PDAs from SYSEXPLG (having SYSEXPLG as a steplib) rather that having private copies of the PDAs in the plug-in library. Something seemed to be wrong with the copies (I did not pursue this further), in any case it worked only correctly after I used the original one at least for the OnNotify method.
Having done all this, I nicely received the GetChildren call whenever I saved the source in the editor.
Kind regards, +o:-]