[Gambas-user] Raises the event
Fabien Bodard
gambas.fr at ...626...
Tue Jul 17 13:40:51 CEST 2012
Because yoy are using your component as a module... A module is static.
Generally a component is based on dynamic classes.
A class must be instanciate.
Dim hmyclass as new CMyClass
Then you can call
Hmyclass.myfuntion
A workaround for you if you want to call you class directly will be to
generate an automatic instance like for the forms by adding
CREATE STATIC
In the top of your class
Then you can call
CMyClass.MyFunction directly.
Le 17 juil. 2012 12:33, "Ivan Kern" <ivan-kern at ...308...> a écrit :
> Hi,
> I mean, if FUNCTION or SUB in my component is not STATIC and I try call
> it from my
> application I get an error message “FUNCTION... is not static.
>
> Thank you, Ivan
>
> -----Ursprüngliche Nachricht-----
> Von: Bruce [mailto:bbruen at ...2308...]
> Gesendet: Dienstag, 17. Juli 2012 11:57
> An: mailing list for gambas users
> Betreff: Re: [Gambas-user] Raises the event
>
> On Tue, 2012-07-17 at 10:12 +0200, Ivan Kern wrote:
> > Hi,
> > What I need is raising an event in my own component.
> > If I declare my FUNCTION or SUB as STATIC and try to raise an event
> > from this function, I get error message "Cannot raise event in static
> > function." But if that is not STATIC and I try call it from my
> > application I get an error message “FUNCTION is not static”.
> >
> > Sorry for my English.
> >
> > Ivan
>
> Ah! I think I may see something. Please explain a bit more about what you
> mean by "But if that is not STATIC and I try call it from my application".
>
> In the meantime, here is a couple of source archives for you to study.
> I have only implemented the "demo_staticRaise" as a library in
> "demo_staticraise2" but maybe it will help.
>
> Bruce
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> 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