Changeset 22 for trunk/Forms
- Timestamp:
- Mar 24, 2018, 12:33:48 AM (7 years ago)
- Location:
- trunk/Forms
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormFields.pas
r20 r22 91 91 if FormField.ShowModal = mrOk then begin 92 92 FormField.Save(NewField); 93 Fields.Add(NewField); 93 Fields.Table.DbClient.Query('INSERT INTO ModelField ( Name , TextBefore) VALUES ( ' + 94 NewField.Name + ' , ' + NewField.TextBefore + ' )'); 94 95 ReloadList; 95 96 end else NewField.Free; … … 107 108 if FormField.ShowModal = mrOk then begin 108 109 FormField.Save(TField(ListView1.Selected.Data)); 110 Fields.Table.DbClient.Query('UPDATE ModelField SET TextBefore = ' + TField(ListView1.Selected.Data).TextBefore + 111 ' WHERE Name = ' + TField(ListView1.Selected.Data).Name); 109 112 ReloadList; 110 113 end; … … 120 123 begin 121 124 if Assigned(ListView1.Selected) then begin 122 Fields. Remove(ListView1.Selected.Data);125 Fields.Table.DbClient.Query('DELETE FROM ModelField WHERE Name = ' + TField(ListView1.Selected.Data).Name); 123 126 ReloadList; 124 127 UpdateInterface; … … 152 155 153 156 procedure TFormFields.ReloadList; 157 var 158 DbRows: TDbRows; 159 NewField: TField; 160 I: Integer; 154 161 begin 162 DbRows := TDbRows.Create; 163 Fields.Table.DbClient.Query('SELECT * FROM ModelField WHERE Model = ' + Fields.Table.Name, DbRows); 164 for I := 0 to DbRows.Count - 1 do begin 165 NewField := TField.Create; 166 NewField.Table := Fields.Table; 167 Fields.Add(NewField); 168 end; 169 DbRows.Free; 170 155 171 ListView1.Items.Count := Fields.Count; 156 172 ListView1.Repaint; -
trunk/Forms/UFormMain.lfm
r19 r22 5 5 Width = 1250 6 6 Caption = 'MyData' 7 ClientHeight = 81 97 ClientHeight = 815 8 8 ClientWidth = 1250 9 DesignTimePPI = 14410 9 Menu = MainMenu1 11 10 OnActivate = FormActivate 12 11 OnClose = FormClose 13 12 OnShow = FormShow 14 LCLVersion = '1.8. 2.0'13 LCLVersion = '1.8.0.4' 15 14 WindowState = wsMaximized 16 15 object StatusBar1: TStatusBar 17 16 Left = 0 18 Height = 3 619 Top = 78 317 Height = 30 18 Top = 785 20 19 Width = 1250 21 20 Panels = <> 21 end 22 object CoolBar1: TCoolBar 23 Left = 0 24 Height = 43 25 Top = 0 26 Width = 1250 27 AutoSize = True 28 Bands = < 29 item 30 Break = False 31 Control = ToolBar1 32 MinHeight = 40 33 MinWidth = 90 34 Width = 179 35 end> 36 Images = Core.ImageList1 37 object ToolBar1: TToolBar 38 AnchorSideLeft.Control = CoolBar1 39 AnchorSideTop.Control = CoolBar1 40 Left = 24 41 Height = 33 42 Top = 5 43 Width = 108 44 Align = alNone 45 BorderSpacing.Left = 22 46 BorderSpacing.Top = 3 47 Caption = 'ToolBar1' 48 EdgeInner = esNone 49 EdgeOuter = esNone 50 Images = Core.ImageList1 51 TabOrder = 0 52 Transparent = True 53 object ToolButton1: TToolButton 54 Left = 1 55 Top = 0 56 Action = Core.ADatabaseConnect 57 end 58 object ToolButton2: TToolButton 59 Left = 37 60 Top = 0 61 Action = Core.ADatabaseDisconnect 62 end 63 object ToolButton3: TToolButton 64 Left = 73 65 Top = 0 66 Action = Core.APreferences 67 end 68 end 22 69 end 23 70 object MainMenu1: TMainMenu -
trunk/Forms/UFormMain.pas
r20 r22 14 14 15 15 TFormMain = class(TForm) 16 CoolBar1: TCoolBar; 16 17 MainMenu1: TMainMenu; 17 18 MenuItem1: TMenuItem; … … 25 26 MenuItemPreferences: TMenuItem; 26 27 StatusBar1: TStatusBar; 28 ToolBar1: TToolBar; 29 ToolButton1: TToolButton; 30 ToolButton2: TToolButton; 31 ToolButton3: TToolButton; 27 32 procedure FormActivate(Sender: TObject); 28 33 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); … … 51 56 begin 52 57 Core.Init; 58 // TODO: Toolbar height is incorrectly calculated 59 ToolBar1.ButtonHeight := ToolBar1.Height; 53 60 end; 54 61 -
trunk/Forms/UFormTables.pas
r21 r22 119 119 if FormTable.ShowModal = mrOk then begin 120 120 FormTable.Save(NewTable); 121 Tables.DbClient.Query('CREATE TABLE ' + NewTable.Name + ' (ID INTEGER)'); 121 Tables.DbClient.Query('INSERT INTO Model ( Name , Caption ) VALUES ( ' + 122 NewTable.Name + ' , ' + NewTable.Caption + ' )'); 122 123 ReloadList; 123 124 end else NewTable.Free; … … 130 131 if FormTable.ShowModal = mrOk then begin 131 132 FormTable.Save(TTable(ListView1.Selected.Data)); 133 DbClient.Query('UPDATE Model SET Name = ' + TTable(ListView1.Selected.Data).Name); 132 134 ReloadList; 133 135 end; … … 138 140 begin 139 141 if Assigned(ListView1.Selected) then begin 140 if MessageDlg(SRemoveTable, Format(SRemoveTableConfirm, [TTable(ListView1.Selected.Data). Name]),142 if MessageDlg(SRemoveTable, Format(SRemoveTableConfirm, [TTable(ListView1.Selected.Data).Caption]), 141 143 mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin 142 Tables.DbClient.Query('D ROP TABLE' + TTable(ListView1.Selected.Data).Name);144 Tables.DbClient.Query('DELETE FROM Model WHERE Name = ' + TTable(ListView1.Selected.Data).Name); 143 145 ReloadList; 144 146 end; … … 175 177 end; 176 178 for C := 0 to FormFields.Fields.Count - 1 do begin 177 OldField := OldTable.Fields. FindByName(TField(FormFields.Fields[C]).Name);179 OldField := OldTable.Fields.SearchByName(TField(FormFields.Fields[C]).Name); 178 180 if Assigned(OldField) then begin 179 181 FI := OldTable.Fields.IndexOf(OldField); … … 210 212 procedure TFormTables.FormCreate(Sender: TObject); 211 213 begin 212 FTables := TTables.Create ;214 FTables := TTables.Create(False); 213 215 end; 214 216
Note:
See TracChangeset
for help on using the changeset viewer.