UserGuide

Overriding System Class Defaults

From Xojo Documentation

This feature allows you to change the default property values used by built-in Xojo classes. For example, you could change the default Windows width and height from 600x400 to 800x600.

These are the steps to override class default values:

  1. Create a file named <ClassName>.defaults in either <SharedDocuments>/Xojo/Overrides or <Documents>/Xojo/Overrides
  2. The file contains simple key=value pairs, where:
    1. The key is the property name on the class
    2. The value is everything after the =
  3. Integer properties can support different values by OS with syntax like this:
    1. Width=20|30|40
    2. macOS uses 20, Windows uses 30, Linux uses 40
  4. String properties do not have a way to include an end-of-line

For example, a file (named Window.defaults and located in ~/Documents/Xojo/Overrides) with the following key/value pairs changes the default width and height of a Window from 600/400 to 800/600:

Width=800
Height=600

After restarting Xojo, when you add any new Windows to a desktop project, they will have a default width of 800 and height of 600.

Notes

CheckBox state can be set with 'State=<value>', where value = 0-Unchecked, 1-Checked, 2-Indeterminate (the values of the Inspector Popup menu for this field).