Changeset 29 for trunk/Forms
- Timestamp:
- Sep 10, 2022, 10:54:56 PM (2 years ago)
- Location:
- trunk/Forms
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormConnect.lfm
r28 r29 87 87 Left = 110 88 88 Height = 43 89 Top = 2589 Top = 16 90 90 Width = 446 91 91 Anchors = [akTop, akLeft, akRight] … … 107 107 ClientWidth = 693 108 108 object Label4: TLabel 109 Left = 1 7109 Left = 19 110 110 Height = 26 111 111 Top = 19 … … 124 124 Left = 19 125 125 Height = 26 126 Top = 58126 Top = 72 127 127 Width = 40 128 128 Caption = 'Port:' … … 130 130 end 131 131 object SpinEditPort: TSpinEdit 132 Left = 15 0132 Left = 152 133 133 Height = 43 134 Top = 58134 Top = 64 135 135 Width = 133 136 136 MaxValue = 65535 -
trunk/Forms/UFormFields.pas
r28 r29 160 160 161 161 procedure TFormFields.ReloadList; 162 var163 DbRows: TDbRows;164 NewField: TField;165 I: Integer;166 162 begin 167 Fields.Clear; 168 DbRows := TDbRows.Create; 169 try 170 Fields.Table.DbClient.Query('SELECT * FROM ModelField WHERE Model = ' + Fields.Table.Name, DbRows); 171 for I := 0 to DbRows.Count - 1 do begin 172 NewField := Fields.AddNew(DbRows[I].Items['Name'], 173 Fields.Table.DbClient.DbManager.DataTypes.SearchByName(DbRows[I].Items['DataType'])); 174 NewField.TextBefore := DbRows[I].Items['Caption']; 175 end; 176 finally 177 DbRows.Free; 178 end; 163 Fields.Load; 179 164 180 165 ListView1.Items.Count := Fields.Count; -
trunk/Forms/UFormRecord.pas
r28 r29 37 37 38 38 uses 39 UDataTypes ;39 UDataTypes, UCore; 40 40 41 41 {$R *.lfm} … … 86 86 const 87 87 LabelWidth = 300; 88 begin 88 var 89 LineHeight: Integer; 90 begin 91 LineHeight := Core.ScaleDPI1.ScaleY(35, Core.ScaleDPI1.DesignDPI.Y); 92 89 93 Row := DataRecord; 90 94 Controls.Clear; 91 95 Labels.Clear; 92 96 for I := 0 to Table.Fields.Count - 1 do begin 93 CellRect := Rect(10, 10 + I * 35, Panel1.Width - 20, (I + 1) * 35);97 CellRect := Rect(10, 10 + I * LineHeight, Panel1.Width - 20, (I + 1) * LineHeight); 94 98 NewLabel := TLabel.Create(Panel1); 95 NewLabel.Caption := T Field(Table.Fields[I]).TextBefore;99 NewLabel.Caption := Table.Fields[I].TextBefore; 96 100 NewLabel.Parent := Panel1; 97 101 NewLabel.Left := CellRect.Left; … … 99 103 NewLabel.Visible := True; 100 104 Labels.Add(NewLabel); 101 case T Field(Table.Fields[I]).DataType.FieldType of105 case Table.Fields[I].DataType.FieldType of 102 106 ftString: begin 103 107 NewControl := TEdit.Create(Panel1); … … 183 187 begin 184 188 for I := 0 to Table.Fields.Count - 1 do begin 185 case T Field(Table.Fields[I]).DataType.FieldType of189 case Table.Fields[I].DataType.FieldType of 186 190 ftString: TValueString(Row.Values[I]).Value := TEdit(Controls[I]).Text; 187 191 ftInteger: TValueInteger(Row.Values[I]).Value := TSpinEdit(Controls[I]).Value; -
trunk/Forms/UFormRecords.pas
r28 r29 60 60 ToolBar1.Buttons[I].Hint := ToolBar1.Buttons[I].Caption; 61 61 Caption := STable + ' - ' + Table.Caption; 62 Table.Fields.Load; 62 63 ReloadList; 63 64 end; … … 68 69 begin 69 70 if (Item.Index >= 0) and (Item.Index < Table.Records.Count) then 70 with T Record(Table.Records[Item.Index])do begin71 with Table.Records[Item.Index] do begin 71 72 for I := 0 to Table.Fields.Count - 1 do begin 72 if I = 0 then Item.Caption := TValue(Values[0]).GetString73 else Item.SubItems.Add( TValue(Values[I]).GetString);73 if I = 0 then Item.Caption := Values[0].GetString 74 else Item.SubItems.Add(Values[I].GetString); 74 75 end; 75 76 Item.Data := Table.Records[Item.Index]; … … 116 117 I: Integer; 117 118 NewValue: TValue; 119 Columns: string; 120 Values: string; 118 121 begin 119 122 NewRecord := TRecord.Create; 120 NewRecord. Parent:= Table;123 NewRecord.Table := Table; 121 124 NewRecord.Values.Count := Table.Fields.Count; 122 125 for I := 0 to Table.Fields.Count - 1 do begin 123 ValueClass := T Field(Table.Fields[I]).GetValueClass;126 ValueClass := Table.Fields[I].GetValueClass; 124 127 NewValue := ValueClass.Create; 125 128 NewRecord.Values[I] := NewValue; … … 132 135 if ShowModal = mrOk then begin 133 136 Save(NewRecord); 134 Table.Records.Add(NewRecord); 137 138 Values := ''; 139 Columns := ''; 140 for I := 0 to Table.Fields.Count - 1 do begin 141 Columns := Columns + Table.Fields[I].Name; 142 Values := Values + '"' + NewRecord.Values[I].GetString + '"'; 143 if I < Table.Fields.Count - 1 then begin 144 Columns := Columns + ' , '; 145 Values := Values + ' , '; 146 end; 147 end; 148 Table.DbClient.Query('INSERT INTO ' + Table.Name + ' ( ' + Columns + ' )' + 149 ' VALUES ( ' + Values + ' )'); 150 151 NewRecord.Free; 135 152 ReloadList; 136 153 end else NewRecord.Free; … … 150 167 I: Integer; 151 168 begin 152 Table. LoadRecords;169 Table.Records.Load; 153 170 154 171 ListViewRecords.Columns.BeginUpdate; 155 while ListViewRecords.Columns.Count > Table.Fields.Count do 156 ListViewRecords.Columns[ListViewRecords.ColumnCount - 1].Free; 157 while ListViewRecords.Columns.Count < Table.Fields.Count do 158 ListViewRecords.Columns.Add; 159 for I := 0 to Table.Fields.Count - 1 do begin 160 ListViewRecords.Columns[I].Caption := TField(Table.Fields[I]).TextBefore; 161 ListViewRecords.Columns[I].Width := 200; 172 try 173 while ListViewRecords.Columns.Count > Table.Fields.Count do 174 ListViewRecords.Columns[ListViewRecords.ColumnCount - 1].Free; 175 while ListViewRecords.Columns.Count < Table.Fields.Count do 176 ListViewRecords.Columns.Add; 177 for I := 0 to Table.Fields.Count - 1 do begin 178 ListViewRecords.Columns[I].Caption := Table.Fields[I].TextBefore; 179 ListViewRecords.Columns[I].Width := 200; 180 end; 181 finally 182 ListViewRecords.Columns.EndUpdate; 162 183 end; 163 ListViewRecords.Columns.EndUpdate;164 184 165 185 ListViewRecords.Items.Count := Table.Records.Count; -
trunk/Forms/UFormTables.pas
r28 r29 73 73 with TTable(FTables[Item.Index]) do begin 74 74 Item.Caption := Caption; 75 Item.SubItems.Add(IntToStr(RecordsCount) + ' ' + IntToStr(Fields.Count));75 Item.SubItems.Add(IntToStr(RecordsCount)); 76 76 Item.Data := FTables[Item.Index]; 77 77 end
Note:
See TracChangeset
for help on using the changeset viewer.