On Friday 15 November 2002 1:25 am, John Levon wrote: > On Fri, Nov 15, 2002 at 11:11:26AM +1000, Allan Rae wrote: > > Can't you just make controller.OKButton() call save() for you since > > "Save" is really just a relabelled OK button? (overloading maybe?) > > good idea. Let's see... > > > I haven't managed to find time to understand how MVC works yet... > > Me neither.
A quick summary: The controller provides the view with a temporary of the thing to be modified. Usually: Params & params(); This variable can be filled by the view at any time, but it usually happens when the controller in View::apply(), invoked by the controller. Ditto, View::update() takes the contents of Controller::params() to initialise the widgets. Pressing the Ok, Apply, Cancel and Restore buttons results in void ControlButtons::OKButton(); void ControlButtons::ApplyButton(); void ControlButtons::CancelButton(); void ControlButtons::RestoreButton(); being called. Ie, the view returns control over what happens next to the controller. To see what exactly the Controller does, have a look at ControlInset.tmpl for the dialogs dealing with inset dialogs and at ControlDialog.tmpl for all non-inset dialogs. Regards, Angus