Ignore:
Timestamp:
Mar 24, 2019, 10:52:35 PM (6 years ago)
Author:
chronos
Message:
  • Modified: More forms use data item property instead Load/Save methods.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormPlayer.pas

    r282 r288  
    2929    Label6: TLabel;
    3030    SpinEditStartUnits: TSpinEdit;
     31    procedure ButtonOkClick(Sender: TObject);
    3132    procedure ComboBoxModeChange(Sender: TObject);
    3233    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
     
    3435    procedure FormShow(Sender: TObject);
    3536  private
    36     { private declarations }
     37    FPlayer: TPlayer;
     38    procedure LoadData(Player: TPlayer);
     39    procedure SaveData(Player: TPlayer);
     40    procedure SetPlayer(AValue: TPlayer);
    3741  public
    3842    procedure Translate;
    3943    procedure UpdateInterface;
    40     procedure LoadData(Player: TPlayer);
    41     procedure SaveData(Player: TPlayer);
     44    property Player: TPlayer read FPlayer write SetPlayer;
    4245  end;
    4346
     
    6467begin
    6568  UpdateInterface;
     69end;
     70
     71procedure TFormPlayer.ButtonOkClick(Sender: TObject);
     72begin
     73  SaveData(FPlayer);
    6674end;
    6775
     
    149157end;
    150158
     159procedure TFormPlayer.SetPlayer(AValue: TPlayer);
     160begin
     161  if FPlayer = AValue then Exit;
     162  FPlayer := AValue;
     163  if Assigned(FPlayer) then LoadData(FPlayer);
     164end;
     165
    151166end.
    152167
Note: See TracChangeset for help on using the changeset viewer.