User Tools

Site Tools


Sidebar

<< Back


koda:en:documentation:appendice_control_templates

Control templates

The default appearance of controls can be modified. For example:

  • The default width of Button controls can be changed
  • As installed, Koda defaults to naming Button controls Button1, Button2 … A control template can change the default names to Btn1, Btn2, etc.

To change the default properties of one or more controls, a file control_templates.xml must be created in the Koda directory. The properties of object types defined in it will override Koda's defaults.

Extras\Control Templates\control_templates.xml is an example. It is listed below.

<control_templates>
  <object type="TAForm">
  <properties>
    <property name="Width" vt="Int8">600</property>
  </properties>
  <components/>
  </object>
  <object type="TAButton" name="Btn%INSTANCE%">
  <properties>
    <property name="Width" vt="Int8">100</property>
    <property name="Height" vt="Int8">30</property>
    <property name="CtrlStyle" vt="Int32">1342291968</property>
  </properties>
  <components/>
  </object>
</control_templates>

It overrides Koda's installation defaults. It changes:

  • the default Width of forms, <color red>TAForm</color>, to 600 pixels
  • the default size of buttons, <color red>TAButton</color>, to 100 x 30 pixels
  • the default style of buttons from <color blue>BS_PUSHBUTTON</color> (to <color blue> BitOr(BS_PUSHBUTTON, BS_FLAT)</color>

All other default properties remain as installed.

The value of <color red>CtrlStyle</color> (and of <color red>Style</color>) is a 32-bit signed-integer combination of Windows styles.

Note <color red>Btn%INSTANCE%</color>. %INSTANCE% is essential. Without it, Koda will try to create buttons Btn, Btn, etc. - and will fail!

The format of the file is critically important. The safest way of creating your own control_templates.xml is to copy appropriate chunks from one of your form (.kxf) files.

Creating control_templates.xml in the Koda directory safeguards against making unintended changes that you cannot easily correct. =)

koda/en/documentation/appendice_control_templates.txt · Last modified: 2014/07/10 10:47 (external edit)