Hi
Easy peasy,
use the observer pattern(I think it is part of mvvm-strategy) i.e.:
0) Have a look at IFPObserved/IFPObserver in TPersistent, how it is
implemented.
1) In your model/view implement the observed part(view don't talk directly
to the backend, only through controller).
In your model/view implement a "Notify" method, so that the model /
backend can call it. This method notifies all registered observers of the
change, taking place.
2) In your view implement the observer part e.g.:
TView = class(TObject,IFPObserver)... etc...
procedure TView.FPOObservedChange(xx,xx,xx);
3) On create-time you connect / register TView with you model/view...
4) When you tell the controller(model/view) to create a new file, it then tells
the model/backend to do the necessary operations, it (model) in turn calls
the "Notify" method of the controller(model/view) along the way to inform
whomever may be listening/observing, of what it's doing...
5) When you're done, you UNregister the TView with the controller (model /
view), to avoid dangling references.
(i) It's harder to describe in short, than it is to implement
EDIT: btw. the following have got no business whatsoever to do in backend:
function TAppDbCreate.SelectDbFilePath: Boolean;
var
saveDialog : TSaveDialog; // BELONGS IN CONTROLLER
begin
// Screen.Cursor := crHourGlass; // BELONGS IN VIEW -> GETS NOTIFIED
how can you send a text back to the main form here? // CALL CTRL.NOTIFY
// Screen.Cursor := crDefault; // BELONGS IN VIEW -> GETS NOTIFIED
end;
HTH
Regards Benny