On Tuesday 13 February 2007 10:02, Paul McNett wrote: > johnf wrote: > > Hi, > > I think I'll start adding small stuff first > > Please review and add to the question wiki. > > > > > > What, why and how of "doDefault()" > > Note that doDefault() is deprecated, in favor of self.super() which > works better. Technically, you are supposed to call doDefault on the > class, not self, but calling it on self works in simple cases. > > > The dDialog class has the “_onEscape” method which captures the “escape” > > key and closes the dialog. So anything I subclass from the class dDialog > > will have the same “escape” key actions. The method below is from the > > dDialog Class. > > > > def _onEscape(self, evt): > > if self.ReleaseOnEscape: > > self.release() > > self.Close() > > > > > > I will create a subclass of dDialog and notice how I identified the > > parent class. Also notice that “doDefault()” requires that I pass any > > parameters the parent requires. In this case I want to set the value of > > a variable if the “escape” key is typed or I could do some other task I > > might need done before passing the program execution to the parent class. > > > > class dynamicDialog(dabo.ui.dDialog): > > def _onEscape(self, evt): > > self.SomeVarVal ="esc" > > print "In the SubClass" > > # Now I pass execution to the parent class along with required > > parameters. self.doDefault(evt) > > It's kind of a bad example, because the method names starting with "_" > aren't meant to be overridden by the user. If the user wants to change > the behavior in this case, they can set self.ReleaseOnEscape to False.
OK let's not use it. -- John Fabiani _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
