Skip to content

Property Metadata

codeCatLady edited this page Sep 20, 2022 · 4 revisions

Property metadata is not the same as widget or library metadata.

Contents

Declaring a property

property "propertyName" get <getter> set <setter> The propertyName is what you will use in LiveCode Script when referring to the property. get the autoHilite of widget "foo"

  • The getter can be any LiveCode Builder expression. In many examples, this is just a variable.
  • The setter is the handler that is called when the property is being set, e.g. when the value is set in the Property Inspector.

property metadata affects how the property appears in the widget's property inspector

label

This is the label that will be used in the property inspector if the user prefers to use readable labels instead of the property name.

metadata myProperty.label is "The Label"

section

This is the section that the property data will appear under. These correspond to the tabs in the property inspector. Default: "Basic", which is the leftmost section

metadata myProperty.section is "Colors"

editor

This is the editor to be used to edit the property. See the Extending LiveCode guide for more information on property editors. NOTE: As of this writing, the Extending Livecode guide does not include any information about the editors)

metadata myProperty.editor is "com.livecode.pi.number"

subeditor

I don't see any reference to this, but it is used in the navbar, for example

metadata itemNames.subeditor is "com.livecode.pi.string"

delimiter

Also not documented, that I can see

metadata.itemNames.delimiter is ","

user_visible

Controls whether the property appears in the property inspector. Default: true

metadata myProperty.user_visible is "false"

read_only

Controls whether the property can be modified in the property inspector. Default: false

metadata myProperty.read_only is "true"

group

Properties can be grouped in the inspector so that they appear in the same row. If there is more than one property in a group, their editors will be arranged side-by-side if possible. I can find examples of this being used in a property data file here and here, but not in any widgets, so I am guessing as to whether this syntax is proper or not

metadata myProperty.group is "Align"

default

  • The default value for the property. When the object is created in the IDE (eg by dragging from the Tools palette), all properties are set to their defaults.
  • Default values may use the execute: syntax. If they do, the script is executed, and the default value for the property is whatever is in the it variable afterward.
  • Occurrences of \n in not-executable default values are replaced by return characters.
  • Properties can be reset to their default in the PI by right-clicking on the value and choosing "Reset to Default"
metadata hiliteColor.default is "10,95,244"

options

The options for an enum or set property. These should be comma delimited. If the display value of an option differs from its actual value, this can be achieved by using colon separation, eg opt1:Option 1,opt2:Option 2,... Option values may use the execute: syntax. If they do, the script is executed, and the options for the property are whatever is in the it variable afterward.

metadata itemStyle.options is "icons,text,both"

subsection

Not currently used, but may be in the future to specify a level of grouping between group and section.

min

The minimum value of a numeric property.

metadata hilitedItem.min is "0"

max

The maximum value of a numeric property.

metadata hilitedItem.max is "255"

step

The amount by which a numeric property should be incremented/decremented by any numeric twiddle.

metadata hilitedItem.step is "1"

References

These are supposed to be identical to those in Property data files, but note that in the files, the underscores are replaced by spaces.