Ask Reuben
File Templates
How can I type code quicker and consistently?
How can I create an example program quickly?
Within Genero Studio, there is the concept of Code Templates. This is functionality whereby you can type Control-T, select a code template and have code inserted into the Code Editor that will save typing and speed up your development as well as improving code consistency. This is useful functionality and it has some functionality that is overlooked. It is this last point I want to emphasise with this article. You can use templates to insert long copyright notices at the beginning of your source code. You can also use it for example programs. So in my last article I talked about minimal reproducible examples to help with support cases. In my Code Templates I have a couple of example programs so that I can simply open a new .4gl/.per/.4st file, type ex and then Control-T, and then from the list select the appropriate example to use as my starting point. So as a small exercise, find the Template Configuration in Genero Studio preferences. with language = Genero BDL, use the + icon to create a few examples that have names beginning “ex” …
… and then in the Code Editor, with a new 4gl, type ex and then Control-T, and select a template you have just created …
… to see how quickly you can create a new .4gl with many lines of code.
Hopefully you see that with 5-15 minutes of investment, you can put yourself in a much better position to create small examples quickly.
Note: There is another longer way to create templates that appear in the File->New dialog, if you are interested in that have a read of this section about creatables.conf.