[Gambas-user] Inheritance issue... or visibility issue... or something I think

Jorge Carrión shordi at ...626...
Sat Jun 11 17:55:23 CEST 2016


Understood. Thanks Benoît.
Best Regards.



2016-06-11 13:22 GMT+02:00 Benoît Minisini <gambas at ...1...>:

> Le 11/06/2016 11:54, Jorge Carrión a écrit :
> > I think that I miss something here.
> >
> > I have a control A inherits usercontainer. It has a property, let's say a
> > connection called Conexion
> >
> > I have another control B inherits, let's say a listbox. It has a Private
> > $conexion as connection variable.
> >
> > in Sub _new() or B, I code this
> >
> > $conexion = me.Parent.Conexion
> >
> > and get a "wanted variant get function" error.
> > If I stop de execution on that line an double-click on me.parent an I can
> > see the Conexion property without problems.
> >
> > But If I code instead:
> >
> > Dim o as object
> > o=me.parent
> > $conexion=o.Conexion
> >
> > Then it works. I have doing something wrong... but, what?
> > See the attached project if I did not been clear enough.
> >
> > Best Regards.
> >
>
> Me.Parent is a Container, so it does not know the 'Conexion' property.
>
> To be able to access the 'Conexion' property, you must assign Me.Parent
> to either:
>
> 1) A variable whose datatype knows the Conexion property: A, or any
> class that inherits A.
>
> 2) An Object variable.
>
> 3) A Variant variable.
>
> If you use 2) and 3), then the property access is resolved at each call,
> which is slow.
>
> If you use 1), the property access is resolved once (the first time it
> is used), and each successive access is fast.
>
> Maybe it should be explained in the "Gambas object model" wiki page.
>
> Regards,
>
> --
> Benoît Minisini
>
>
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and
> traffic
> patterns at an interface-level. Reveals which users, apps, and protocols
> are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity
> planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list