After few first versions where was only header and footer customizable, was decided to generate code from templates. This give user full control over his code. Basically, code generator create few independent code parts: includes, message loop code, events code etc. When creating final code, special variables in the templates are replaced with those parts, but don't touch any user code. This give needed flexibility, but keep simplicity.
Initial Koda installation containing two example templates - for message loop and event code. You can with those templates what you want, you also can add unlimited number of your own templates.
All your templates are keeps in the fd.xml configuration file and will not lost when reinstall program.
In your templates you can use variables:
%INCLUDES% - not used atm
%OPTIONS% - will be replaced with Opt() options
%EXPVARINITCODE% - will be replaced with init code for variables, expanded from %VAR%
%GUICODE% - will be replaced with GUI code
%LOOPCODEBEGIN% - this is pseudovariable, indicates where loop should begin
%CONTROL_ID% - will be replaced with control ID
%LOOPCODEEND% - this is pseudovariable, indicates where loop should end
%EVENTSCODEBEGIN% - this is pseudovariable, indicates where event functions block should begin
%EVENTNAME% - will be replaced with event name
%EVENTSCODEEND% - this is pseudovariable, indicates where event functions block should end