Am Sonntag, 21. September 2008 16:20:27 schrieb Ed Leafe:
>
> Events need to be bound to event handlers; the only requirement for a
> method to be an event handler is that it accept the event object
> passed to it. In a form, first(), next(), etc., are methods, not event
> handlers. What is in that code is a trick that changes an object-level
> method to an event handler. I think that this sort of coding is
> confusing and should be avoided. Instead, I would prefer something
> more explicit:
>
Should have seen the event object for myself, but it _is_ confusing if form
method and event handler have the same name.
> btn = dabo.ui.dButton("First", OnHit=self.onFirst)
>
> def onFirst(self, evt):
> self.first()
>
>
> Using this, the distinction between the event handler and the method
> that is called by the handler is clear. Also, it will not break any
> other code in the form that may call self.first(), since that method
> now expects an event object.
>
If I don't do anything else in this event handler I can leave out the def
statement, because the form has got an event handler called "onFirst" anyway
and it does exactly this, is that right? And if the event handler should do
other things besides calling "self.first()", it might be better to use
beforeFirst() and afterFirst(), right?
Thank you for the clarification,
Sibylle
--
Dr. Sibylle Koczian
_______________________________________________
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/[EMAIL PROTECTED]