Ignore:
Timestamp:
Mar 18, 2022, 3:47:27 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/UWebObjects.pas

    r130 r132  
    66
    77uses
    8   Classes, SysUtils, UHtmlClasses, UXmlClasses, SpecializedList, SpecializedDictionary;
     8  Classes, SysUtils, UHtmlClasses, UXmlClasses, SpecializedDictionary, fgl;
    99
    1010type
    11   TListView = class
    12 
    13   end;
    14 
    1511  TQueryFormItemType = (fitText, fitComboBox, fitRadioButton, fitSelect, fitPassword,
    1612    fitSubmit, fitReset, fitHidden, fitFileSelect, fitButton, fitCheckBox, fitTextArea);
     
    3834  { TQueryFormItemList }
    3935
    40   TQueryFormItemList = class(TListObject)
     36  TQueryFormItemList = class(TFPGObjectList<TQueryFormItem>)
    4137    function FindByName(AValue: string): TQueryFormItem;
    4238  end;
     
    5349  end;
    5450
     51  TQueryFormGroups = class(TFPGObjectList<TQueryFormGroup>)
     52  end;
     53
    5554  TQueryAction = class
    5655    Caption: string;
    5756    Action: string;
     57  end;
     58
     59  TQueryActions = class(TFPGObjectList<TQueryAction>)
    5860  end;
    5961
     
    6365  public
    6466    Title: string;
    65     Groups: TListObject; // TListObject<TQueryFormGroup>
    66     Actions: TListObject; // TListObject<TQueryAction>
     67    Groups: TQueryFormGroups;
     68    Actions: TQueryActions;
    6769    ClassId: string;
    6870    function AddNewGroup: TQueryFormGroup;
     
    7274    destructor Destroy; override;
    7375  end;
     76
    7477
    7578implementation
     
    122125destructor TQueryFormItem.Destroy;
    123126begin
    124   Value.Free;
    125   inherited Destroy;
     127  FreeAndNil(Value);
     128  inherited;
    126129end;
    127130
     
    189192function TQueryForm.AddNewGroup: TQueryFormGroup;
    190193begin
    191   Result := TQueryFormGroup(Groups.AddNew(TQueryFormGroup.Create));
     194  Result := TQueryFormGroup.Create;
     195  Groups.Add(Result);
    192196end;
    193197
    194198function TQueryForm.AddNewAction(Caption, Action: string): TQueryAction;
    195199begin
    196   Result := TQueryAction(Actions.AddNew(TQueryAction.Create));
     200  Result := TQueryAction.Create;
    197201  Result.Caption := Caption;
    198202  Result.Action := Action;
     203  Actions.Add(Result);
    199204end;
    200205
     
    210215begin
    211216  inherited;
    212   Actions := TListObject.Create;
    213   Groups := TListObject.Create;
     217  Actions := TQueryActions.Create;
     218  Groups := TQueryFormGroups.Create;
    214219  Method := 'post';
    215220  Action.AsString := '';
     
    218223destructor TQueryForm.Destroy;
    219224begin
    220   Actions.Free;
    221   Groups.Free;
    222   inherited Destroy;
     225  FreeAndNil(Actions);
     226  FreeAndNil(Groups);
     227  inherited;
    223228end;
    224229
     
    238243function TQueryFormGroup.AddNewItem: TQueryFormItem;
    239244begin
    240   Result := TQueryFormItem(Rows.AddNew(TQueryFormItem.Create));
     245  Result := TQueryFormItem.Create;
     246  Rows.Add(Result);
    241247end;
    242248
     
    248254destructor TQueryFormGroup.Destroy;
    249255begin
    250   Rows.Free;
    251   inherited Destroy;
     256  FreeAndNil(Rows);
     257  inherited;
    252258end;
    253259
Note: See TracChangeset for help on using the changeset viewer.