[Mindwrapper] proposed changes in presenters
Status: Alpha
Brought to you by:
donnal
From: Donnal W. <don...@ya...> - 2003-04-19 14:55:51
|
This is just to give everyone a heads up that I intend to make significant changes in how references are used by presenters in the near future. The current way that component presenters (like TextField and SpinButton) work is that they accept a single 'ref' argument to be the model (from the abstraction layer) for that presenter. The proposed change is to allow all presenters (both components and composites) to accept a list of references, the FIRST of which will act as the model for the presenter. Other references in the list will form the arguments for event handlers, so that it will be easier to write event handlers. The prototype for this technique: ... wx.EVT_XXX(self, self.GetId(), self._onEvent) def _onEvent(self, event): self.OnEvent(*self._ref) event.Skip() def OnEvent(self, model, arg1, arg2): # this method overridden to do something # with model and other arguments An alternative would be to pass the event to OnEvent() as well: def _onEvent(self, event): self.OnEvent(event, *self._ref) event.Skip() def OnEvent(self, event, model, arg1, arg2): # this method overridden to do something # with model, arguments and event Regards, ===== Donnal Walter Arkansas Children's Hospital |