One of the common tasks I've been doing for months now, as I'm learning PowerBASIC, is typing in test code. I normally just have a few sample files in a folder and I call one up, modify it, and add the test code.
Today, I finally got around to trying out templates. Much better! Any code you have can be a template, just put 3 lines at the top and save it into the PB\bin folder with a .pbtpl extension. Here are the 3 lines of code to use at the top of your template file.
Here are four tips for using templates:
1. They show up in the IDE sorted by the template file name, not by the title you give the template! I like mine in a certain order, so I renamed the files accordingly.
2. When you load a template, you can't just press Compile to see what happens. You have to make a change to the loaded code (even as simple as pressing a space bar) before the IDE will compile the template code.
3. The IDE also requires that you save the code to a file before it will compile. I created a file called "_.bas". With that name it will always be at the top of the Save As dialog and is ready-at-hand to select as the file name to be used for saving the modified template code. I treat it like a temp file, never putting anything of value in it and always overwriting it whenever I test new code snippets.
4. The pipe symbol | is used in a template to tell the IDE where the cursor is to be placed when the template is loaded. However, the IDE doesn't seem to be willing to place a cursor at all depths. So stick with 1-3 indentations and you should be fine.
I just put the code for 3 template suggestions in the Source Code forum.
I'd be interested in seeing the templates anyone else has found useful.
Unless you have discussion about your templates, I suggest you place them in the Source Code forum too.
My templates can also be found and downloaded on my website at
http://www.garybeene.com/power/pb-tutor-templates.htm.
Today, I finally got around to trying out templates. Much better! Any code you have can be a template, just put 3 lines at the top and save it into the PB\bin folder with a .pbtpl extension. Here are the 3 lines of code to use at the top of your template file.
Code:
1 .bas Any Title - This is displayed in the PB IDE
1. They show up in the IDE sorted by the template file name, not by the title you give the template! I like mine in a certain order, so I renamed the files accordingly.
2. When you load a template, you can't just press Compile to see what happens. You have to make a change to the loaded code (even as simple as pressing a space bar) before the IDE will compile the template code.
3. The IDE also requires that you save the code to a file before it will compile. I created a file called "_.bas". With that name it will always be at the top of the Save As dialog and is ready-at-hand to select as the file name to be used for saving the modified template code. I treat it like a temp file, never putting anything of value in it and always overwriting it whenever I test new code snippets.
4. The pipe symbol | is used in a template to tell the IDE where the cursor is to be placed when the template is loaded. However, the IDE doesn't seem to be willing to place a cursor at all depths. So stick with 1-3 indentations and you should be fine.
I just put the code for 3 template suggestions in the Source Code forum.
I'd be interested in seeing the templates anyone else has found useful.
Unless you have discussion about your templates, I suggest you place them in the Source Code forum too.
My templates can also be found and downloaded on my website at
http://www.garybeene.com/power/pb-tutor-templates.htm.
Comment