Ignore:
Timestamp:
Jan 25, 2015, 9:41:26 PM (10 years ago)
Author:
chronos
Message:
  • Added: Preferences dialog window.
  • Modified: Currently selected database is set in TCore class in field Database.
  • Added: Application remembers name of previous opened database and reopen it during startup.
  • Modified: FormDatabases is now used as modal form.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormTables.pas

    r8 r9  
    4545      Selected: Boolean);
    4646  private
     47    FDatabase: TDatabase;
     48    procedure SetDatabase(AValue: TDatabase);
    4749    { private declarations }
    4850  public
    49     Database: TDatabase;
     51    property Database: TDatabase read FDatabase write SetDatabase;
    5052    procedure UpdateInterface;
    5153    procedure ReloadList;
     
    8082end;
    8183
     84procedure TFormTables.SetDatabase(AValue: TDatabase);
     85begin
     86  if FDatabase = AValue then Exit;
     87  FDatabase := AValue;
     88  ReloadList;
     89end;
     90
    8291procedure TFormTables.UpdateInterface;
    8392begin
    84   AModify.Enabled := Assigned(ListView1.Selected);
    85   ARemove.Enabled := Assigned(ListView1.Selected);
    86   AShowRecords.Enabled := Assigned(ListView1.Selected);
    87   AShowFields.Enabled := Assigned(ListView1.Selected);
     93  ListView1.Enabled := Assigned(Database);
     94  AAdd.Enabled := Assigned(Database);
     95  AModify.Enabled := Assigned(Database) and Assigned(ListView1.Selected);
     96  ARemove.Enabled := Assigned(Database) and Assigned(ListView1.Selected);
     97  AShowRecords.Enabled := Assigned(Database) and Assigned(ListView1.Selected);
     98  AShowFields.Enabled := Assigned(Database) and Assigned(ListView1.Selected);
    8899end;
    89100
     
    190201procedure TFormTables.FormShow(Sender: TObject);
    191202begin
    192   ReloadList;
     203  UpdateInterface;
    193204end;
    194205
    195206procedure TFormTables.ReloadList;
    196207begin
    197   ListView1.Items.Count := Database.Tables.Count;
    198   ListView1.Repaint;
     208  if Assigned(Database) then begin
     209    ListView1.Items.Count := Database.Tables.Count;
     210    ListView1.Repaint;
     211  end else ListView1.Items.Count := 0;
    199212  UpdateInterface;
    200213end;
Note: See TracChangeset for help on using the changeset viewer.