Paul McNett wrote: > Uwe Grauer wrote: >> Paul McNett wrote: >>> Uwe Grauer wrote: >>>> Which event is best to use if a Form gets called (shown)? >>>> Is it onActivate or is there something better? >>>> I asking to find a better place to initialize my called form with the >>>> parameters which got set from the parentform. >>> onActivate will get called whenever the form (re)takes the focus. So if >>> you use that you should set a flag so that you don't call the same init >>> code over and over again. >>> >> I do this now, with a flag. >> >>> You can also try overriding afterInit() or afterInitAll(), which are >>> hook methods that get called rather late in the init cycle. >>> >> Overriding? >> I thought that afterInit[All] is called after the createForm. >> >> This is called to show a childform: >> def callEditEtyp(self, newrec=False): >> frmclass = "EditEtyp.cdxml" >> frm = dabo.ui.createForm(frmclass) >> frm.parentform = self >> if newrec: >> frm.newrec = True >> frm.etypiid = None >> else: >> frm.newrec = False >> currow = self.dGridEtyp.CurrentRow >> curiid = self.PrimaryBizobj.getDataSet(rowStart=currow, >> rows=1)[0]['iid'] >> frm.etypiid = curiid >> self.hide() >> frm.showModal() >> >> May i ask some more on how to do it when i come back from my childform? > > You know, you are basically wanting to set properties on your child form > from the main form, so the best way in your case may be to define > properties in the child form, and then just pass those properties to the > constructor. For example: > > class ChildForm(dabo.ui.dForm): > def _getNewRec(self): > return getattr(self, "_newRec", None) > def _setNewRec(self, val): > self._newRec = bool(val) > NewRec = property(_getNewRec, _setNewRec)
I still don't understand where to define these properties in the Classdesigner. Uwe _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
