Changeset 15 for trunk/Forms/UItemAdd.pas
- Timestamp:
- Jun 13, 2011, 8:25:31 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 4 4 heaptrclog.trc 5 5 chronis.exe 6 DebugLog.txt
-
- Property svn:ignore
-
trunk/Forms/UItemAdd.pas
r14 r15 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, 9 StdCtrls, Spin, EditBtn, MaskEdit, USqlDatabase, USystem; 9 StdCtrls, Spin, EditBtn, MaskEdit, USqlDatabase, USystem, 10 SpecializedDictionary, SpecializedList; 10 11 11 12 type … … 28 29 public 29 30 Report: TReport; 31 ControlList: TListObject; 30 32 end; 31 33 … … 48 50 49 51 procedure TItemAddForm.ButtonSaveClick(Sender: TObject); 52 var 53 Data: TDictionaryStringString; 54 I: Integer; 55 DataType: TDataType; 50 56 begin 57 with Core.System do 58 try 59 Data := TDictionaryStringString.Create; 60 for I := 0 to Report.Columns.Count - 1 do 61 if TReportColumn(Report.Columns[I]).ColumnName <> 'Id' then begin 62 DataType := TReportColumn(Report.Columns[I]).CustomType; 63 Data.Add(TReportColumn(Report.Columns[I]).ColumnName, DataType.GetControlValue(TWinControl(ControlList[I]))); 64 end; 65 Database.Insert(MainForm.SelectedObject.Table, Data, MainForm.SelectedObject.Schema); 66 finally 67 Data.Free; 68 end; 69 MainForm.LoadItemList; 51 70 Close; 52 71 end; … … 62 81 Report := TReport.Create; 63 82 Report.Base := Core.System; 83 ControlList := TListObject.Create; 84 ControlList.OwnsObjects := False; 64 85 end; 65 86 … … 67 88 begin 68 89 Report.Free; 90 ControlList.Free; 69 91 end; 70 92 … … 97 119 98 120 // Load column names 121 ControlList.Clear; 99 122 for I := 0 to Report.Columns.Count - 1 do 100 123 if TReportColumn(Report.Columns[I]).ColumnName <> 'Id' then begin … … 113 136 NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2; 114 137 NewControl.Width := (Width div ColumnCount) div 2 - 20; 138 ControlList.Add(NewControl); 115 139 116 140 Column := (Column + 1) mod 2; 117 141 if Column = 0 then LastTop := LastTop + NewControl.Height + 4; 118 end ;142 end else ControlList.Add(nil); 119 143 end; 120 144
Note:
See TracChangeset
for help on using the changeset viewer.