http://www.newton-inc.com/dev/techinfo/qa/qa.htm
stepChildren
slot of the base view of the template file. If both the exported and importing template have children, they will both have a stepChildren
slot. The result is that the stepChildren
slot of the importing prototemplate is masking the one in the exported proto. The instantiated view does not collect all the children from the entire proto chain (though NTK does do this at compile time for user proto templates).stepChildren
is to add a viewSetupChildrenScript
to either your exported proto template or the importer that collects all of the stepChildren
into a runtime stepChildren
array.// AFTER setting up stepChildren, views which "import" this proto
// must call inherited:?viewSetupChildrenScript();
exporter.viewSetupChildrenScript := func()
begin
// get the current value of the "extra" kids
// ...unless the importer added NO kids, in which case, these are OURS
local extraKids := stepChildren;
local items := clone(extraKids);
local kids;
local whichFrame := self;
while (whichFrame) do
begin
// get kids, but NOT using inheritance
kids := GetSlot(whichFrame, 'stepChildren);
// copy any extra stepChildren (but if NO extra kids are defined, don't copy twice!)
if kids and kids <> extraKids then
ArrayMunger(items, 0, 0, kids, 0, nil);
// go deeper into the _proto chain (or set whichFrame to nil)
whichFrame := whichFrame._proto;
end;
stepChildren := items;
end;
stepAllocateContext
slot.