[Gambas-user] About Raise Events
Demosthenes Koptsis
demosthenesk at ...626...
Mon Jul 4 10:47:41 CEST 2011
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
Object.Attach(hCar, Me, "hCar")
hCar.StartEngine
hCar.IncreaseSpeed
End
Public Sub hCar_Run()
Print "Car is running"
End
--------------
in the example if i remove line
Object.Attach(hCar, Me, "hCar")
and use RAISE in class i cant use
Public Sub hCar_Run() as default event handler.
i attach the project.
to see what i am describing remove line 9
Object.Attach(hCar, Me, "hCar")
from Main.module.
--
Regards,
Demosthenes Koptsis.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Project91.tar.gz
Type: application/x-compressed-tar
Size: 5549 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20110704/6856983d/attachment.bin>
More information about the User
mailing list