[Gambas-user] About Raise Events

Demosthenes Koptsis demosthenesk at ...626...
Mon Jul 4 18:52:15 CEST 2011


On Mon, 2011-07-04 at 15:40 +0200, Benoît Minisini wrote:
> > On Mon, 2011-07-04 at 11:26 +0200, Fabien Bodard wrote:
> > > 2011/7/4 Demosthenes Koptsis <demosthenesk at ...626...>:
> > > > Hello,
> > > > 
> > > > i have a class CCar with an event Run().
> > > > 
> > > > When i implement the object hCar in module Main
> > > > i have to use Object.Attach to use the event handler for the event Run.
> > > > 
> > > > At page http://gambasdoc.org/help/lang/eventdecl says
> > > > "By default, Name_EventName is the name of the method called in the
> > > > event listener when an event is raised."
> > > > 
> > > > 
> > > > But without Object.Attach(hCar, Me, "hCar") i cannot use the event
> > > > 
> > > > Example
> > > > ------------
> > > > ' Gambas module file
> > > > 
> > > > Private hCar As CCar
> > > > 
> > > > Public Sub Main()
> > > 
> > > -->  hCar = New CCar as "hcar"
> > > 
> > > This is how you must declare an event handler !
> > 
> > Yes i know that.
> > 
> > hObject = NEW MyClass
> > Object.Attach(hObject, ME, "EventName")
> > 
> > is equivalent to:
> > 
> > hObject = NEW MyClass AS "EventName"
> > 
> > 
> > 
> > when i declare an event in a class.
> > 
> > EVENT Run
> > 
> > in class CCar.
> > 
> > i expected the object hCar to autocomplete in editor the
> > hCar_Run as default event handler, as this is done with properties
> > hCar.Doors etc.
> > 
> > my question is,
> > why this autocomplete is not done for default event handlers and i should
> > declare a handler hCar ?
> > 
> 
> Because the IDE can only handle event names declared statically (i.e. with NEW 
> ... AS "xxx"), not those declared dynamically with Object.Attach().
> 
> Regards,
> 

ok i comment Object.Attach() and declared ... AS "hCar"

------
  hCar = New CCar As "hCar"
  
'  Object.Attach(hCar, Me, "hCar")  
-------

Still the IDE does not make autocopmlete even for statically
declarations.

Public Sub hCar_

does not show autocomplete.

i use gambas3-svn3888




-- 
Regards,
Demosthenes Koptsis.





More information about the User mailing list