Template within a Template

I am making a #Procedure template wherein the procedure requires the DOSFileLookUp Control template. What is the method (if any) of incorporating the placement of the code template into my Procedure template?

I think you are in wizard territory more than req territory. Like the way you say you want to add a a browse procedure, and the wizard asks you what file you want to browse and creates a window with a browse control on it. So I’d look at the wizard templates for guidance. Hopefully I’m pointing you in the right direction.

1 Like

Actually, no browse. The procedure opens the file, parses it into records and fields, and adds records to an existing file.

REQ() is not used on a #Procedure template.
I can place a DOSFileLookUp Code template on the procedure’s window at time of development, but I was hoping it might be possible to place the code template from within the Procedure template.

Browse was just an example. I’m suggesting that rather than adding something onto what is existing (like update buttons onto a browse – which I know you don’t have – just an example), you are saying what you want your procedure to be like, and the procedure will be built with the bells and whistles that come with that “type” of procedure.

So, as a starting point for building a template I think you would start with a template like the WindowWizard, which is a #Utility template in ABWREP.TPW. And at the point where it calls the group #INSERT(%CustomizationOtherWindowPrompts)
which does things like set the font and add OK and Cancel buttons, you would add in the controls you need to select a text file, and maybe to specify the file where the parsed info would be put.

Personally, not being much of a template language person, I’d probably be happy creating a procedure with the window and the controls, having the code that does the parsing and saving in a derived windowmanager embed, and that would be it. If I wanted it in some other app I’d just copy it from the app I created it in. From your description it doesn’t sound like there is anything that a programmer needs to do to customize anything.

I use the “wizard factory” technology for this purpose. The idea is that we develop regular window procedures with the necessary functionality, including various templates and manual code, and then convert them into wizards. One wizard can create one or more procedures. Technically, the procedures are saved in txa format, and then they need to be processed in a text editor and included in tpw files. This is a powerful tool because it allows you to create specialized wizards very quickly and then use them for new procedures.

Search for the Template ABBrowse.tpw (in C6).

#PROCEDURE(Browse,'Browse Fields in a List Box'),WINDOW,REPORT,HLP('~TPLProcBrowse'),PARENT(Window(ABC))
#DEFAULT
NAME DefaultABCBrowse
CATEGORY 'Browse'
[COMMON]
DESCRIPTION 'Browse with Update and Select'
FROM ABC Window
[PROMPTS]

This is a Default template which creates a window, with various controls already on them and all you need to do is select the File.

It shows how a default window can be made with various default controls already populated for you, much like what you are asking for with the DOSFileLookUp control template.

1 Like