On Wednesday 13 June 2007 08:09, Ed Leafe wrote:
> On Jun 13, 2007, at 10:57 AM, johnf wrote:
> > When I design a class and want to bind an Event (to the class) do I
> > bind it as
> > self.Form.bindEvent(dEvent,????, _function) since I don't have an
> > instance of
> > the class?    IOW how can I bind an event to my class from within
> > the class?
>
>       I'm not sure I understand what you mean. First, if the event is
> something that is raised by your class, you can't bind the form to
> it: a double-click in a grid is not sent to the form; it's sent to
> the grid. So what I think you want to do is bind an event in your
> class to a pre-determined form method. If that is the case, and you
> don't mind linking the classes like that, you would probably do
> something like this in your class:
>
> def initEvents(self):
>       if self.Form and hasattr(self.Form, "someHandler"):
>               self.bindEvent(dEvents.SomeEvent, self.Form.someHandler)
>
> This will bind 'SomeEvent' (whatever you desire) to a method on the
> form called 'someHandler', as long as that method exists.
>
> -- Ed Leafe
> -- http://leafe.com
> -- http://dabodev.com
Basicly I want to bind "RowNumChanged" to update a property.  I think it would 
be best if the binding took place in the class.  That way the class is self 
contained.  In dGrid you did:
if biz:
                                ## I think I want to have the bizobj raise the 
RowNumChanged event,
                                ## but for now this will suffice:
                                self.Form.bindEvent(dEvents.RowNumChanged, 
self.__onRowNumChanged)

Any suggestion on keeping the class self contained would help.
-- 
John Fabiani


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]

Reply via email to