Changeset 21 for trunk/Forms
- Timestamp:
- Mar 23, 2018, 3:06:47 PM (7 years ago)
- Location:
- trunk/Forms
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormTables.lfm
r20 r21 10 10 OnActivate = FormActivate 11 11 OnClose = FormClose 12 OnCreate = FormCreate 13 OnDestroy = FormDestroy 12 14 OnShow = FormShow 13 15 LCLVersion = '1.8.0.6' -
trunk/Forms/UFormTables.pas
r20 r21 40 40 procedure FormActivate(Sender: TObject); 41 41 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 42 procedure FormCreate(Sender: TObject); 43 procedure FormDestroy(Sender: TObject); 42 44 procedure FormShow(Sender: TObject); 43 45 procedure ListView1Data(Sender: TObject; Item: TListItem); … … 45 47 Selected: Boolean); 46 48 private 49 FDbClient: TDbClient; 47 50 FTables: TTables; 48 procedure Set Tables(AValue: TTables);51 procedure SetDbClient(AValue: TDbClient); 49 52 public 50 property Tables: TTables read FTables write SetTables; 53 property DbClient: TDbClient read FDbClient write SetDbClient; 54 property Tables: TTables read FTables; 51 55 procedure UpdateInterface; 52 56 procedure ReloadList; … … 87 91 end; 88 92 89 procedure TFormTables.SetTables(AValue: TTables); 90 begin 91 if FTables = AValue then Exit; 92 FTables := AValue; 93 procedure TFormTables.SetDbClient(AValue: TDbClient); 94 begin 95 if FDbClient = AValue then Exit; 96 FDbClient := AValue; 97 FTables.DbClient := AValue; 93 98 ReloadList; 94 99 end; … … 114 119 if FormTable.ShowModal = mrOk then begin 115 120 FormTable.Save(NewTable); 116 Tables. Add(NewTable);121 Tables.DbClient.Query('CREATE TABLE ' + NewTable.Name + ' (ID INTEGER)'); 117 122 ReloadList; 118 123 end else NewTable.Free; … … 135 140 if MessageDlg(SRemoveTable, Format(SRemoveTableConfirm, [TTable(ListView1.Selected.Data).Name]), 136 141 mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin 137 Tables. Remove(ListView1.Selected.Data);142 Tables.DbClient.Query('DROP TABLE ' + TTable(ListView1.Selected.Data).Name); 138 143 ReloadList; 139 144 end; … … 201 206 procedure TFormTables.FormClose(Sender: TObject; var CloseAction: TCloseAction); 202 207 begin 203 //Tables.DbClient.Save; 208 end; 209 210 procedure TFormTables.FormCreate(Sender: TObject); 211 begin 212 FTables := TTables.Create; 213 end; 214 215 procedure TFormTables.FormDestroy(Sender: TObject); 216 begin 217 FTables.Free; 204 218 end; 205 219 … … 208 222 I: Integer; 209 223 begin 224 ReloadList; 210 225 for I := 0 to ToolBar1.ButtonCount - 1 do 211 226 ToolBar1.Buttons[I].Hint := ToolBar1.Buttons[I].Caption; … … 217 232 I: Integer; 218 233 begin 234 if Assigned(DbClient) then DbClient.LoadTables(Tables) 235 else Tables.Clear; 219 236 for I := 0 to Tables.Count - 1 do 220 237 TTable(Tables[I]).LoadRecordsCount;
Note:
See TracChangeset
for help on using the changeset viewer.