dabo Commit Revision 427 Date: 2004-08-31 20:53:34 -0700 (Tue, 31 Aug 2004) Author: paul
Log: Removed the dControls dict and the addControl() method from dForm and instead let the controls handle their own event bindings. Simpler.
Changed: U trunk/ui/uiwx/dDataControlMixin.py U trunk/ui/uiwx/dForm.py U trunk/ui/uiwx/dPageDataNav.py
Diff: Modified: trunk/ui/uiwx/dDataControlMixin.py =================================================================== --- trunk/ui/uiwx/dDataControlMixin.py 2004-09-01 01:29:03 UTC (rev 426) +++ trunk/ui/uiwx/dDataControlMixin.py 2004-09-01 03:53:34 UTC (rev 427) @@ -22,6 +22,7 @@ def initEvents(self): dDataControlMixin.doDefault() + self.Form.bindEvent(dEvents.ValueRefresh, self.onValueRefresh) def onCreate(self, event): dDataControlMixin.doDefault(event)
Modified: trunk/ui/uiwx/dForm.py =================================================================== --- trunk/ui/uiwx/dForm.py 2004-09-01 01:29:03 UTC (rev 426) +++ trunk/ui/uiwx/dForm.py 2004-09-01 03:53:34 UTC (rev 427) @@ -62,8 +62,6 @@ self.bizobjs = {} self._primaryBizobj = None - self.dControls = {} - if not isinstance(self, wx.MDIChildFrame): self.CreateStatusBar() @@ -112,36 +110,6 @@ pass - def addControl(self, control): - """ Add a control to this form. - - This happens automatically for dControls. - """ - self.dControls[control.Name] = control - - # Set up the control to receive the notification - # from the form that it's time to refresh its value, - # but only if the control is set up to receive these - # notifications (if it has a onValueRefresh Method). - try: - func = control.onValueRefresh - except AttributeError: - func = None - if func: - self.bindEvent(dEvents.ValueRefresh, func) - - # Set up the control to receive the notification - # from the form that that the row number changed, - # but only if the control is set up to receive these - # notifications (if it has a onRowNumChanged Method). - try: - func = control.onRowNumChanged - except AttributeError: - func = None - if func: - self.bindEvent(dEvents.RowNumChanged, func) - - def refreshControls(self): """ Refresh the value of all contained dControls.
Modified: trunk/ui/uiwx/dPageDataNav.py =================================================================== --- trunk/ui/uiwx/dPageDataNav.py 2004-09-01 01:29:03 UTC (rev 426) +++ trunk/ui/uiwx/dPageDataNav.py 2004-09-01 03:53:34 UTC (rev 427) @@ -307,7 +307,10 @@ def __init__(self, parent): dBrowsePage.doDefault(parent, "pageBrowse") - + def initEvents(self): + dBrowsePage.doDefault() + self.Form.bindEvent(dEvents.RowNumChanged, self.onRowNumChanged) + def onRowNumChanged(self, event): # If RowNumChanged is received AND we are the active page, select # the row in the grid. @@ -504,6 +507,10 @@ self.dataSource = dataSource self.bizobj = self.Form.getBizobj().getChildByDataSource(self.dataSource) + def initEvents(self): + dChildViewPage.doDefault() + self.Form.bindEvent(dEvents.RowNumChanged, self.onRowNumChanged) + def onPageEnter(self, event): dChildViewPage.doDefault(event) if self.bizobj and self.bizobj.RowCount >= 0:
©2004 noreply (AT) paulmcnett DOT com |