[Lazarus] Object free itself?
Graeme Geldenhuys
graemeg.lists at gmail.com
Thu May 15 21:22:15 CEST 2008
2008/5/15 Lee Jenkins <lee at datatrakpos.com>:
>
> I've never tried this type of thing before, but I have need to have an object
> free self.
Not allowed, as far as I know. The execution point has nowhere to
return to after the 'inherited Destroy' line and before the 'end' of
the destructor.
As another object to destroy it. eg: I use something similar in fpGUI.
I post a message to the fpgApplication instance and request it to free
of a modeless form (create for CreateForm()).
> BTW, I'm trying my hand at creaing an MVC and I need the controller to be able
> to free itself because it is the object that 1) Creates the View (form) and 2)
> the Model (object) and mediates between them.
Out of interest. Have you had a look at MGM (Model-GUI-Mediator) yet?
I'm using it in our current projects and having great success with it.
MGM fits in somewhere between MVC and MVP. I think it ties in much
better with todays more advanced GUI toolkits. It's also very simple
to implement. tiOPF contains an implementation using RTTI to automate
a lot of things, but a much simpler implementation could have been
used as well.
More info on MGM at: http://www.atug.com/andypatterns/mgm.htm
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
More information about the Lazarus
mailing list