Paul McNett wrote: > Uwe Grauer wrote: >> I already noticed, that i could call self.Form.cancel() which does the >> trick, but what about the 'CancelButton = True' thing? > > Well, you have a few problems. First, the only thing CancelButton does > is map pressing Esc to pushing the button. You still have to write code > inside the button's onHit method to have it do what you want to do, in > your case calling self.Form.cancel(). > > Next, I'm not sure why you are getting an AttributeError setting the > CancelButton property. Here is a standalone test. Please let me know if > it works: > > #-- > import dabo > > app = dabo.dApp(MainFormClass=None) > app.setup() > > def onCancelButton(evt): > print "Cancel" > > frm = dabo.ui.dForm() > btn = frm.addObject(dabo.ui.dButton, CancelButton=True, Caption="Cancel") > btn.bindEvent(dabo.dEvents.Hit, onCancelButton) > frm.show() > app.start() > #-- > > Next, on Ubuntu at least, pressing Esc doesn't fire the button's Hit > event like it should. This I'll add to the tracker as it is a Dabo issue. >
The code snippet prints "Cancel" on Opensuse 10.1 when the Button is pressed. Esc isn't working too. But i'm using ClassDesigner, which is different coding. I will go with the self.Form.cancel() for now.
Thanks, Uwe
©2006 Uwe Grauer |