This shows you the differences between two versions of the page.
— |
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, | ||
+ | |||
+ | A code template consists of // | ||
+ | |||
+ | 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. | ||
+ | < | ||
+ | {{ code_templates_editor.png? | ||
+ | </ | ||
+ | |||
+ | The pseudo-variables and the code generated by them are: | ||
+ | |||
+ | **%INCLUDES%** - all the <color blue># | ||
+ | |||
+ | **%OPTIONS%** - <color blue> | ||
+ | |||
+ | **%EXPVARINITCODE%** - declarations of variables for all <color blue> | ||
+ | |||
+ | **%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 | ||
+ | \\ | ||
+ | # | ||
+ | |||
+ | <code autoit> | ||
+ | ; #FUNCTION# ======================================== | ||
+ | ; Name...........: | ||
+ | ; Description ...: | ||
+ | ; Syntax.........: | ||
+ | ; Parameters ....: none | ||
+ | ; Author ........: | ||
+ | ; ================================================== | ||
+ | Func %EVENTNAME%() | ||
+ | |||
+ | EndFunc ; | ||
+ | %EVENTSCODEEND% | ||
+ | </ | ||
+ | |||
+ | For each control for which the //OnClick// property is //True//, Koda generates a block of code starting with <color blue>; FUNCTION ====</ | ||
+ | |||
+ | 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. | ||
+ | |||