User Tools

Site Tools


koda:en:documentation:dialog_code_template_editor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

koda:en:documentation:dialog_code_template_editor [2014/07/10 10:48] (current)
Line 1: Line 1:
 +====== Code Templates Editor ======
 +
 +//To access this editor, go to//:
 +  * //Options -> Options, Code Generator -> Templates, and double-click on a template name, or//
 +  * //Tools -> Generating Options, choose a template, and click on Manage.//
 +<columns 100%> 
 +
 +
 +Unlike the first few versions where only headers and footers were customizable, now Koda generates code from templates. This gives users full control over the generation of code.
 +
 +A code template consists of //pseudo-variables// and AutoIt code. Pseudo-variables are explained below.
 +
 +You can create as many templates as you wish. They are stored in fd.xml, Koda's repository 
 +for its settings, so templates you create are available for generating code from all your forms.
 +
 +Templates are preserved when you update to a newer version of Koda.
 +
 +Two templates are provided: **Loop Example** and **Event Example**. The Default templates (one for Message Loop and one for OnEvent) are internal representations of the Example templates, so we suggest that you leave the Example templates as is -- so you can refer to them later -- and create your own.
 +<newcolumn> 
 +{{  code_templates_editor.png?nocache|}}
 +</columns>
 +
 +The pseudo-variables and the code generated by them are:
 +
 +**%INCLUDES%** -  all the <color blue>#include</color>s required for the form and the controls
 +
 +**%OPTIONS%** - <color blue>Opt</color> (<color blue>AutoItSetOption</color>) settings. For example, if in Object Inspector you set  Resizing | DocLeft to True, %OPTIONS% generates <color blue>Opt("GUIResizeMode", $GUI_DOCKLEFT)</color>.
 +
 +**%EXPVARINITCODE%** - declarations of variables for all <color blue>%var%</color> in captions, if in [[dialog_generating_options|Tools -> Generating Options]] //Expand %var% variables// is checked.
 +
 +**%GUICODE%** - the code generated by the form and controls
 +
 +**%LOOPCODEBEGIN%** - indicates where the block to be repeated in Message Loop Mode begins
 +
 +**%CONTROL_ID%** - in Message Loop Mode, generates a control name
 +
 +**%LOOPCODEEND%** indicates where the block to be repeated in Message Loop Mode ends
 +
 +**%EVENTSCODEBEGIN%** - indicates where the block to be repeated in OnEvent Mode begins
 + 
 +**%EVENTNAME%** - in OnEvent Mode, generates a control name
 +
 +**%EVENTSCODEEND%** - indicates where the block to be repeated in OnEvent Mode ends
 +\\
 +#term_definition[An example for OnEvent Mode]#
 +
 +<code autoit>%EVENTSCODEBEGIN%
 +; #FUNCTION# ========================================
 +; Name...........: %EVENTNAME%
 +; Description ...: 
 +; Syntax.........: %EVENTNAME%()
 +; Parameters ....: none
 +; Author ........: 
 +; ==================================================
 +Func %EVENTNAME%()
 +
 +EndFunc ;==>%EVENTNAME%
 +%EVENTSCODEEND% 
 +</code>
 +
 +For each control for which the //OnClick// property is //True//, Koda generates a block of code starting with <color blue>; FUNCTION ====</color> and ending with <color blue>EndFunc ;==>//%EVENTNAME%//</color>
 +
 +If  controls Button1 and Button2 have OnClick set to True, in the first block %EVENTNAME% will be replaced with Button1 and in the second with Button2.
 +
 +If //Generate events for all controls// is checked, Koda generates a block for every control in the form.
 +
  
koda/en/documentation/dialog_code_template_editor.txt ยท Last modified: 2014/07/10 10:48 (external edit)