Re: A solution for Nilling Child form pointers

From: Martin James (mjames_falcon_at_dial.pipex.com)
Date: 10/26/03


Date: Sun, 26 Oct 2003 01:18:03 +0100


..or maybee something like: (just a suggesiton - may not work in MDI
framework?)

type

    pTformRef=^Tform;

TautoDestructForm=class(TForm)
private
    pRef:TformRef;
public
    constructor create(anOwner:TComponent;pFormRef::pTformRef);
    destructor destroy; override;
end;

TautoDestructForm.create(pFormRef::pTformRef);
begin
    pRef:=pFormRef;
    inherited create(anOwner);
    pRef^:=self;
end;

TautoDestructForm.destroy;
begin
    pRef^:=nil;
    inherited;
end;

..
..
myForm:TautoDestructForm;
..
..
TautoDestructForm.create(self,@myForm);

Using the constructor/destructor gives you a form to derive from that
auto-destroys its reference & frees up the tag/onDestroy events.

Rgds,
Martin



Relevant Pages

  • Re: OO business class vs data class..
    ... In addition to this, the Private variables the object's Public accessor properties use will be set to some default state like 0 for ConatctNo, NullString for ContractName, etc, etc when the object is instantiated. ... The CSLA book and the framework will give the grass roots of OO and show the basic objects that you'll need to develop a OO solution. ... The CSLA framework is a library of base objects that a NET developer derives his or her objects from to develop a solution with some consistency and other things. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Multiple MDI Child Icons and Control Boxes Why??
    ... Private Sub MenuItem2_Click(ByVal sender As System.Object, ... experienced a bug once with relation to the MDI child list in the menu but I ... If the form isn't already open the code carries on past the above and opens ... icon is usually the icon from the last form opened not the start form's own ...
    (microsoft.public.dotnet.languages.vb)
  • =?windows-1252?Q?Re=3A_MFC_SDI_Application_without_a_?= =?windows-1252?Q?default_=93New_Docu
    ... El 20/04/2010 9:56, Mikel Luri escribió: ... I want to modify this ... But unfortunately it doesn't seem to work now, because framework is ... But you can have a MDI with a 1 document limit though, ...
    (microsoft.public.vc.mfc)
  • =?windows-1252?Q?Re=3A_MFC_SDI_Application_without_a_?= =?windows-1252?Q?default_=93New_Docu
    ... I want to modify this ... But unfortunately it doesn't seem to work now, because framework is ... sending the command ID_FILE_NEW instead of calling the virtual ... But you can have a MDI with a 1 document limit though, and you can prevent a new document from opening at startup with MDI ...
    (microsoft.public.vc.mfc)
  • Re: MFC MDI replacement
    ... MFC is just a framework for MDI development. ... AFAIK WTL supports it. ... in WIn95 - you open a new top-level window for each document. ... I don't know of a framework supporting tabbed views yet. ...
    (microsoft.public.vc.language)