Changeset 14 for trunk/Forms/UItemEdit.pas
- Timestamp:
- Jun 10, 2011, 2:16:52 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UItemEdit.pas
r12 r14 36 36 37 37 uses 38 UMainForm ;38 UMainForm, UDataTypes, UCore; 39 39 40 40 {$R *.lfm} … … 63 63 begin 64 64 Report := TReport.Create; 65 Report.Base := MainForm.System;65 Report.Base := Core.System; 66 66 end; 67 67 … … 80 80 var 81 81 Values: TDbRows; 82 NewControl: TControl;83 82 LastTop: Integer; 84 83 I: Integer; 85 84 Column: Integer; 86 ValueType: Integer; 85 DataType: TDataType; 86 NewControl: TWinControl; 87 NewLabel: TLabel; 87 88 const 88 89 ColumnCount = 2; … … 100 101 if TReportColumn(Report.Columns[I]).ColumnName <> 'Id' then begin 101 102 102 NewControl := TLabel.Create(Panel1); 103 NewLabel := TLabel.Create(Panel1); 104 NewLabel.Parent := Panel1; 105 NewLabel.Top := LastTop; 106 NewLabel.Left := Column * Width div ColumnCount + 10; 107 NewLabel.Caption := TReportColumn(Report.Columns[I]).Caption + ':'; 108 109 DataType := TReportColumn(Report.Columns[I]).CustomType; 110 NewControl := DataType.CreateControl(Panel1); 111 DataType.Load(TReportLine(Report[0]).Items[I]); 112 DataType.SetupControl(NewControl); 103 113 NewControl.Parent := Panel1; 104 114 NewControl.Top := LastTop; 105 NewControl.Left := Column * Width div ColumnCount + 10; 106 TLabel(NewControl).Caption := TReportColumn(Report.Columns[I]).Caption + ':'; 107 108 ValueType := TReportColumn(Report.Columns[I]).TypeDef.TypeIndex; 109 if ValueType = Integer(vtInteger) then begin 110 NewControl := TSpinEdit.Create(Panel1); 111 NewControl.Parent := Panel1; 112 NewControl.Top := LastTop; 113 NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2; 114 TSpinEdit(NewControl).Value := StrToInt(TReportLine(Report[0]).Items[I]); 115 TSpinEdit(NewControl).Width := (Width div ColumnCount) div 2 - 20; 116 end else 117 if ValueType = Integer(vtDate) then begin 118 NewControl := TDateEdit.Create(Panel1); 119 NewControl.Parent := Panel1; 120 NewControl.Top := LastTop; 121 NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2; 122 TDateEdit(NewControl).Date := StrToDate(TReportLine(Report[0]).Items[I]); 123 TDateEdit(NewControl).Width := (Width div ColumnCount) div 2 - 20; 124 end else 125 if ValueType = Integer(vtFloat) then begin 126 NewControl := TFloatSpinEdit.Create(Panel1); 127 NewControl.Parent := Panel1; 128 NewControl.Top := LastTop; 129 NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2; 130 TFloatSpinEdit(NewControl).Value := StrToFloat(TReportLine(Report[0]).Items[I]); 131 TFloatSpinEdit(NewControl).Width := (Width div ColumnCount) div 2 - 20; 132 end else 133 if ValueType = Integer(vtString) then begin 134 NewControl := TEdit.Create(Panel1); 135 NewControl.Parent := Panel1; 136 NewControl.Top := LastTop; 137 NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2; 138 TEdit(NewControl).Text := TReportLine(Report[0]).Items[I]; 139 TEdit(NewControl).Width := (Width div ColumnCount) div 2 - 20; 140 end else 141 if ValueType = Integer(vtPassword) then begin 142 NewControl := TMaskEdit.Create(Panel1); 143 NewControl.Parent := Panel1; 144 NewControl.Top := LastTop; 145 NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2; 146 TMaskEdit(NewControl).Width := (Width div ColumnCount) div 2 - 20; 147 end else 148 if ValueType = Integer(vtBoolean) then begin 149 NewControl := TCheckBox.Create(Panel1); 150 NewControl.Parent := Panel1; 151 NewControl.Top := LastTop; 152 NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2; 153 TCheckBox(NewControl).Checked := Boolean(StrToInt(TReportLine(Report[0]).Items[I])); 154 end else begin 155 NewControl := TEdit.Create(Panel1); 156 NewControl.Parent := Panel1; 157 NewControl.Top := LastTop; 158 NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2; 159 TEdit(NewControl).Width := (Width div ColumnCount) div 2 - 20; 160 TEdit(NewControl).Text := TReportLine(Report[0]).Items[I]; 161 end; 115 NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2; 116 NewControl.Width := (Width div ColumnCount) div 2 - 20; 162 117 163 118 Column := (Column + 1) mod 2;
Note:
See TracChangeset
for help on using the changeset viewer.