Ignore:
Timestamp:
Sep 10, 2022, 10:21:48 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Do not create all application forms at initialization phase but dynamically.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormRecord.pas

    r26 r28  
    55uses
    66  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
    7   ComCtrls, ActnList, StdCtrls, EditBtn, UDatabase, Contnrs, Spin;
     7  ComCtrls, ActnList, StdCtrls, EditBtn, UDatabase, Spin, Generics.Collections;
    88
    99type
     
    2626    Table: TTable;
    2727    Row: TRecord;
    28     Controls: TObjectList; // TListObject<TControl>
    29     Labels: TObjectList; // TListObject<TControl>
     28    Controls: TObjectList<TControl>;
     29    Labels: TObjectList<TControl>;
    3030    procedure ReloadControls;
    3131    procedure Load(DataRecord: TRecord);
     
    3333  end;
    3434
    35 var
    36   FormRecord: TFormRecord;
    3735
    3836implementation
     
    4341{$R *.lfm}
    4442
     43resourcestring
     44  STableRecordEdit = 'Table record edit';
     45
    4546{ TFormRecord }
    4647
    4748procedure TFormRecord.FormShow(Sender: TObject);
    4849begin
    49   Caption := 'Table record edit - ' + Table.Caption;
     50  Caption := STableRecordEdit + ' - ' + Table.Caption;
    5051  ReloadControls;
    5152end;
     
    6364procedure TFormRecord.FormCreate(Sender: TObject);
    6465begin
    65   Controls := TObjectList.Create;
    66   Labels := TObjectList.Create;
     66  Controls := TObjectList<TControl>.Create;
     67  Labels := TObjectList<TControl>.Create;
    6768end;
    6869
    6970procedure TFormRecord.FormDestroy(Sender: TObject);
    7071begin
    71   Labels.Free;
    72   Controls.Free;
     72  FreeAndNil(Labels);
     73  FreeAndNil(Controls);
    7374end;
    7475
Note: See TracChangeset for help on using the changeset viewer.