====== Current Form Generating Options ====== Tools -> Generating Options allows you to set parameters for generating code for the currently active form. Setting parameters here overrides the settings in Options -> Options -> Code Generator that were in effect when the form was created. They are saved with the form. {{ dialog_generating_options.png |}} Template In the drop-down control, you can choose a code-generation template. While the Default template is capable of generating either Message Loop or OnEvent AutoIt GUI code, other templates generate only code for one AutoIt mode. Clicking on the **Manage** button displays the [[options_code_generator_templates|Code Templates dialog]]. Here you can view and edit existing code templates, and created new ones. This dialog has two tabs: Options and Formatting. Options If **Generate OnEvent code** is not checked, only code templates that generate Message Loop code are available in the Template drop-down control. If it is checked, only code templates that generate OnEvent code are available. In Message-Loop mode, an //event// is handled in a Case; in OnEvent mode, it is handled by a Click function. If **Generate events for all controls** is not checked, //event// code is only generated for controls that have the OnClick property set in Object Inspector. If it is checked, //event// code is generated for all controls. If **Expand %var% variables** is not checked, Captions are converted to code literally. If it is checked, characters between the % signs are taken to be the name of a variable, possibly resulting in an expression. An example: Info for user %user% generates "Info for user " & $user. AutoIt permits the programmer to code //use the default// for various parameters to GUI functions by entering -1. If **Variables instead of '-1' where possible** is unchecked, Koda generates -1 where possible. If it is checked, Koda generates variables and constants that are the defaults. Formatting {{ dialog_generating_options_format.png |}} The **Indent char** can be a //tab// or a //space//. The calls to GUI functions (in Message Loop mode), and OnClick functions (in OnEvent mode) are indented **Init** characters. Other lines are indented an additional **Count** indent characters times the indent level. The default is for Koda not to declare control ID and % variables: the **Scope** of **Variables** is //Not set//. //Global// declares the variables as Global in generated code; //Local// declares them as Local.