Property override

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Property override

Leon Davis
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.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: Property override

Tobias Boege-2
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

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: Property override

Leon Davis
Thank you

On Thu, Apr 27, 2017 at 9:14 AM, Tobias Boege <[hidden email]> wrote:

> 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
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user