Ignore:
Timestamp:
Jul 20, 2018, 9:48:47 AM (6 years ago)
Author:
chronos
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormTargets.pas

    r51 r92  
    1010type
    1111
    12   { TFormCompilers }
     12  { TFormTargets }
    1313
    14   TFormCompilers = class(TForm)
     14  TFormTargets = class(TForm)
    1515    ListView1: TListView;
    1616    procedure FormShow(Sender: TObject);
    1717    procedure ListView1Data(Sender: TObject; Item: TListItem);
    1818    procedure ListView1DblClick(Sender: TObject);
     19    procedure ListView1KeyPress(Sender: TObject; var Key: char);
    1920  private
    2021    { private declarations }
     
    2425
    2526var
    26   FormCompilers: TFormCompilers;
     27  FormTargets: TFormTargets;
    2728
    2829implementation
     
    3334  UCore, UTarget, UFormTargetOptions;
    3435
    35 { TFormCompilers }
     36{ TFormTargets }
    3637
    37 procedure TFormCompilers.FormShow(Sender: TObject);
     38procedure TFormTargets.FormShow(Sender: TObject);
    3839begin
    3940  ReloadList;
    4041end;
    4142
    42 procedure TFormCompilers.ListView1Data(Sender: TObject; Item: TListItem);
     43procedure TFormTargets.ListView1Data(Sender: TObject; Item: TListItem);
    4344begin
    4445  if (Item.Index >= 0) and (Item.Index < Core.Targets.Count) then
     
    5152end;
    5253
    53 procedure TFormCompilers.ListView1DblClick(Sender: TObject);
     54procedure TFormTargets.ListView1DblClick(Sender: TObject);
    5455begin
    55   FormTargetOptions.LoadControls(TTarget(ListView1.Selected.Data));
    56   if FormTargetOptions.ShowModal = mrOk then begin
    57     FormTargetOptions.SaveControls(TTarget(ListView1.Selected.Data));
    58     ReloadList;
     56  FormTargetOptions := TFormTargetOptions.Create(nil);
     57  try
     58    FormTargetOptions.LoadControls(TTarget(ListView1.Selected.Data));
     59    if FormTargetOptions.ShowModal = mrOk then begin
     60      FormTargetOptions.SaveControls(TTarget(ListView1.Selected.Data));
     61      ReloadList;
     62    end;
     63  finally
     64    FormTargetOptions.Free;
    5965  end;
    6066end;
    6167
    62 procedure TFormCompilers.ReloadList;
     68procedure TFormTargets.ListView1KeyPress(Sender: TObject; var Key: char);
     69begin
     70  if Key = #13 then ListView1DblClick(nil);
     71end;
     72
     73procedure TFormTargets.ReloadList;
    6374begin
    6475  ListView1.Items.Count := Core.Targets.Count;
Note: See TracChangeset for help on using the changeset viewer.