Embedding code in another template's embed point (the resizer's Resize method), and listing template instances

Applies to: ABC window resizer template; posted in the Clarion 10 group; no version named.

Problem

A template wants to stop the ABC resize template from resizing windows, and so needs to generate code in the resizer's embed: #AT(%ResizerMethodCodeSection,%ActiveTemplateInstance,'Resize','(),BYTE'),PRIORITY(5000). Nothing generated there, even with the instance hard-coded. A second question: a loop over %ActiveTemplate printed the template names without their instances.

Solution

  1. Bruce J. used an #AT that names no instance and selects by a WHERE clause instead:
#AT(%ResizerMethodCodeSection),Priority(6000),where((%pClassMethod='Resize')
 and (%pClassMethodPrototype='(),BYTE'))

The poster confirmed this works for his purpose.
2. Instances need a nested loop, because %ActiveTemplateInstance depends on %ActiveTemplate:

#FOR(%ActiveTemplate)
  #FOR(%ActiveTemplateInstance)
  1. Arnor B. added: if your template can require the target, use REQ(WindowResize(ABC)) and then %ActiveTemplateParentInstance in the #AT in place of the instance symbol.
  2. Related symbols, all dependent on %ActiveTemplateInstance: %ActiveTemplateOwnerInstance, %ActiveTemplateParentInstance, %ActiveTemplatePrimaryInstance, to walk the relation of templates in a procedure.

Caveats

  • The poster could not use REQ because his template must work when the resizer is absent.
  • The WHERE form was described by Arnor B. as handy for forcing code into other templates' embeds.

Today (2026)

Not re-tested; the symbols are documented in the template help. Likely unchanged.

Sources: Liam (Oct 2015, the question), Bruce J. (Oct 2015), Arnor B. (Oct 2015) in sv.clarion.clarion10.