Ed Leafe wrote:
> On Jan 19, 2009, at 4:41 PM, Roger Lovelock wrote:
> 
>> Following Sample exhibits the behaviour!
> 
> 
>       OK, there is a bug here, but it has to do with the way that auto- 
> binding of events is handled. I'm not sure why it's looking in both  
> forms for a matching method name, but it is.

I haven't looked, but it probably goes up the self.Parent hierarchy, and 
because one 
form is the child of another...

>       I would suggest not using this style of binding, even after we fix  
> the bug. 

I agree.

Auto binding of events was another of those ideas that sounded great at the 
time, but 
that I for one never or rarely ended up using in practice. It makes samples 
look 
really cool because there's less code, but in real life I really prefer longer, 
explicit code over shorter, implicit code.

> Now it's much simpler to simply pass the event binding in the  
> constructor of the button:

> btn = dabo.ui.dButton(self.mainpanel, Caption="Click Me",  
> OnHit=self.onButton1Click)

Yes, this is the preferred way of doing it when dealing with instances, but 
more 
often than not I define subclasses and do very little, if any, instance 
programming. 
So, I still usually explicitly call self.bindEvent(...) in my subclass 
afterInit method.

But this instance programming style makes code almost as concise as the 
auto-bind 
style, but still explicit, so it is definitely preferred.

Paul

_______________________________________________
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]

Reply via email to