[Gambas-user] Property override

Tobias Boege taboege at ...626...
Thu Apr 27 16:14:04 CEST 2017


On Thu, 27 Apr 2017, Leon Davis wrote:
> Using Gambas v3.9.2 and GTK+3
> 
> I am creating a component and would like to override the Caption property.
> 
> 
> 
> Public Const _Properties as String = "*,Caption"
> 
> Property Read {Caption} as String
> 
> 
> 
> Causes an "improper override error". I've also tried encasing the word
> Caption in the _Properties statement with curly brackets "{Caption}". Any
> assistance is greatly appreciated.

It depends on *where* you want to override the Caption property, but my
guess is that Caption is a read-write property in the class you want to
override. You can't make it read-only by overriding, i.e. the "Read"
keyword in your "Property Read" declaration causes the error.

Mandatory reading: http://gambaswiki.org/wiki/doc/object-model, which
exactly states that:

  3.5. Symbol Overriding
  [...]
     * A read/write property must be overridden by a read/write property with the same datatype.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list