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