I been writing a class and I found this problem when a event is raised. I wrote my class in a form class to take advantage of visual design (my class just does visual things).
I wrote an event in the form class and when the event is raised the problem appears: apparently the form self captures the event. So, when I create an object from this class, I can't catch the event unless I use Object.Attach: 'Inside the form class "myClass" Event myEvent ... Raise myEvent 'Inside a form Private myObject = myClass Public Sub _New() myObject = New MyClass(Me) AS "myObject" End Public myObject_MyEvent() 'Nothing to do here, the event doesn't reach here End But if: Public Sub _New() myObject = New MyClass(Me) Object.Attach(myObject ,Me, "myObject") End Then, the problem is gone. I think than if I use an Observer this should work too. Anyway, I think that problem occurs because the form class catchs their own event (form is their own observer). I think that I could workaround this by creating a second class (not a form class) and by using the form class like as one of its members, but seems to me than form class should have a way to avoid your own observer. Am I right? -- Fabián Flores Vadell www.speedbooksargentina.blogspot.com ------------------------------------------------------------------------------ _______________________________________________ Gambas-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gambas-user
