Template file format
GavinWraith (26) 1563 posts |
The format of Template files is described on page 4-455 of the PRMs. It appears that template files can only contain two kinds of data: windows (plus their icons) or font descriptors. The latter must follow the former. It would be very simple to extend the format to other sorts of objects (with entry types other than 1 = window). I was wondering if anyone knew of somebody doing this. I quite understand that use of the toolbox renders template files obsolete. However they could also be used for menus; even for code, perhaps? I have not thought this through – it may well be a pointless exercise. |
Rick Murray (539) 13840 posts |
I’m not sure about code, but I have wondered why nobody ever thought to place menu blocks in Template files. Sure, it is easier on the eye to build them from messages, but there are numerous instances of prebuilt menus in their own files (David Pilling does this), it always seemed a bit of a missed opportunity not to permit these resources that are both Wimp specific and likely to be language dependent inside a Templates file, at least as an option.
I think the ultimate test would be to create some additional objects filled with random junk data, and see if the Wimp correctly ignores it, or craps itself trying to figure out what is going on.
I use Templates. Most of my windows are pretty simple, as is the code that drives them. I don’t really need the additional complications of the toolbox event system just to show a window or two and react to it. The only thing that I think is a shame is there there is, to my knowledge, no tool to decompose toolbox window definitions to Templates files. That way, Templates windows could be created with style guide compliance baked in, and the same designer used for both types of window definition. |
Richard Mawhood (2655) 24 posts |
I’ve used Template files for menus. This was for small WIMP programs written in Basic, for my own use (never released). The advantage was that you could use Wimp_LoadTemplate, made for neater code. Then I wanted library routines to handle the whole caboodle, which made it trickier. In the end it was easier to write a program to assemble menu structures, and save them all in a data file. The library got an unpacking procedure. Then the calling program needs just one line of code to get all the menus. I think this is what Dr Wimp and similar packages do, but it was fun writing my own. |