[Gambas-devel] About property declaration in components
Benoit Minisini
gambas at ...1...
Thu Aug 24 22:41:35 CEST 2006
The way of declaring the list of the possible values of a property has
changed!
The old way was:
GB_PROPERTY("PropertyName", "i<Class,FirstValue,SecondValue...>",
PropertyFunction)
Now, everything must be put in the "_Properties" string constant declared in
the class.
The new syntax of this hidden property is:
_Properties = "<PROP1>,<PROP2>,...,<PROPn>"
<PROPi> = "-<NAME>"
or "<NAME>{<TYPE>}=<DEFAULT>"
<NAME> is the name of the property.
<DEFAULT> is the default value of the property. It must be preceded by an
equal sign.
<TYPE> is the type of the property. It must be between { }. It is used by the
IDE property sheet.
The <DEFAULT> and <TYPE> are optional.
If <TYPE> is missing, then the type of the property is determined from the
Gambas property type declared with the GB_PROPERTY macro. The IDE property
sheet can deal with Font, Picture, String[] and all native types properties
at the moment.
Otherwise, the syntax of <TYPE> is the following:
- "<CLASS>.*" or "<CLASS>.<CONST1>;<CONST2>;...;<CONSTn>" for an integer
property that can take only one value among a predefined list of constants.
Note that in this case, the <DEFAULT> value must be the name of the constant,
and not its integer value.
Or <TYPE> can be:
- "Path" for a string property that is a file path.
- "Color" for an integer property that is a color.
- "Range:Min;Max" for an integer property whose value must be between Min and
Max.
Other types will be implemented in the future.
Regards,
--
Benoit Minisini
More information about the Devel
mailing list