Changeset 9 for trunk/Forms/UFormTables.pas
- Timestamp:
- Jan 25, 2015, 9:41:26 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormTables.pas
r8 r9 45 45 Selected: Boolean); 46 46 private 47 FDatabase: TDatabase; 48 procedure SetDatabase(AValue: TDatabase); 47 49 { private declarations } 48 50 public 49 Database: TDatabase;51 property Database: TDatabase read FDatabase write SetDatabase; 50 52 procedure UpdateInterface; 51 53 procedure ReloadList; … … 80 82 end; 81 83 84 procedure TFormTables.SetDatabase(AValue: TDatabase); 85 begin 86 if FDatabase = AValue then Exit; 87 FDatabase := AValue; 88 ReloadList; 89 end; 90 82 91 procedure TFormTables.UpdateInterface; 83 92 begin 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); 88 99 end; 89 100 … … 190 201 procedure TFormTables.FormShow(Sender: TObject); 191 202 begin 192 ReloadList;203 UpdateInterface; 193 204 end; 194 205 195 206 procedure TFormTables.ReloadList; 196 207 begin 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; 199 212 UpdateInterface; 200 213 end;
Note:
See TracChangeset
for help on using the changeset viewer.