Changeset 14 for trunk/Forms/UFormRecord.pas
- Timestamp:
- Mar 22, 2018, 7:59:13 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormRecord.pas
r8 r14 87 87 NewControl: TControl; 88 88 CellRect: TRect; 89 const 90 LabelWidth = 300; 89 91 begin 90 92 Row := DataRecord; … … 92 94 Labels.Clear; 93 95 for I := 0 to Table.Fields.Count - 1 do begin 94 CellRect := Rect(10, 10 + I * 70, Panel1.Width - 20, (I + 1) * 70);96 CellRect := Rect(10, 10 + I * 35, Panel1.Width - 20, (I + 1) * 35); 95 97 NewLabel := TLabel.Create(Panel1); 96 98 NewLabel.Caption := TField(Table.Fields[I]).TextBefore; … … 103 105 ftString: begin 104 106 NewControl := TEdit.Create(Panel1); 105 NewControl.Parent := Panel1; 106 NewControl.Left := CellRect.Left; 107 NewControl.Top := CellRect.Top + NewLabel.Height + 6; 108 NewControl.Width := CellRect.Right - CellRect.Left; 107 NewControl.Anchors := [akLeft, akTop, akRight]; 108 NewControl.Parent := Panel1; 109 NewControl.Left := CellRect.Left + LabelWidth; 110 NewControl.Top := CellRect.Top; 111 NewControl.Width := CellRect.Right - CellRect.Left - LabelWidth; 109 112 NewControl.Visible := True; 110 113 TEdit(NewControl).Text := TValueString(Row.Values[I]).Value; … … 114 117 NewControl := TSpinEdit.Create(Panel1); 115 118 NewControl.Parent := Panel1; 116 NewControl.Left := CellRect.Left ;117 NewControl.Top := CellRect.Top + NewLabel.Height + 6;118 NewControl.Width := CellRect.Right - CellRect.Left ;119 NewControl.Left := CellRect.Left + LabelWidth; 120 NewControl.Top := CellRect.Top; 121 NewControl.Width := CellRect.Right - CellRect.Left - LabelWidth; 119 122 NewControl.Visible := True; 120 123 TSpinEdit(NewControl).Value := TValueInteger(Row.Values[I]).Value; … … 124 127 NewControl := TDateEdit.Create(Panel1); 125 128 NewControl.Parent := Panel1; 126 NewControl.Left := CellRect.Left ;127 NewControl.Top := CellRect.Top + NewLabel.Height + 6;128 NewControl.Width := CellRect.Right - CellRect.Left ;129 NewControl.Left := CellRect.Left + LabelWidth; 130 NewControl.Top := CellRect.Top; 131 NewControl.Width := CellRect.Right - CellRect.Left - LabelWidth; 129 132 NewControl.Visible := True; 130 133 TDateEdit(NewControl).Date := TValueDateTime(Row.Values[I]).Value; … … 134 137 NewControl := TCheckBox.Create(Panel1); 135 138 NewControl.Parent := Panel1; 136 NewControl.Left := CellRect.Left ;137 NewControl.Top := CellRect.Top + NewLabel.Height + 6;138 NewControl.Width := CellRect.Right - CellRect.Left ;139 NewControl.Left := CellRect.Left + LabelWidth; 140 NewControl.Top := CellRect.Top; 141 NewControl.Width := CellRect.Right - CellRect.Left - LabelWidth; 139 142 NewControl.Visible := True; 140 143 TCheckBox(NewControl).Checked := TValueBoolean(Row.Values[I]).Value; … … 144 147 NewControl := TFloatSpinEdit.Create(Panel1); 145 148 NewControl.Parent := Panel1; 146 NewControl.Left := CellRect.Left ;147 NewControl.Top := CellRect.Top + NewLabel.Height + 6;148 NewControl.Width := CellRect.Right - CellRect.Left ;149 NewControl.Left := CellRect.Left + LabelWidth; 150 NewControl.Top := CellRect.Top; 151 NewControl.Width := CellRect.Right - CellRect.Left - LabelWidth; 149 152 NewControl.Visible := True; 150 153 TFloatSpinEdit(NewControl).Value := TValueFloat(Row.Values[I]).Value; 154 Controls.Add(NewControl); 155 end; 156 ftImage: begin 157 NewControl := TImage.Create(Panel1); 158 NewControl.Parent := Panel1; 159 NewControl.Left := CellRect.Left + LabelWidth; 160 NewControl.Top := CellRect.Top; 161 NewControl.Width := CellRect.Right - CellRect.Left - LabelWidth; 162 NewControl.Height := NewLabel.Height; 163 NewControl.Visible := True; 164 //TImage(NewControl).Value := TValueFloat(Row.Values[I]).Value; 165 Controls.Add(NewControl); 166 end; 167 ftReference: begin 168 NewControl := TComboBox.Create(Panel1); 169 NewControl.Parent := Panel1; 170 NewControl.Left := CellRect.Left + LabelWidth; 171 NewControl.Top := CellRect.Top; 172 NewControl.Width := CellRect.Right - CellRect.Left - LabelWidth; 173 NewControl.Height := NewLabel.Height; 174 NewControl.Visible := True; 175 176 TComboBox(NewControl).Items.Add(IntToStr(TValueReference(Row.Values[I]).Value)); 151 177 Controls.Add(NewControl); 152 178 end; … … 166 192 ftBoolean: TValueBoolean(Row.Values[I]).Value := TCheckBox(Controls[I]).Checked; 167 193 ftFloat: TValueFloat(Row.Values[I]).Value := TFloatSpinEdit(Controls[I]).Value; 194 //ftImage: TValueFloat(Row.Values[I]).Value := TFloatSpinEdit(Controls[I]).Value; 168 195 end; 169 196 end;
Note:
See TracChangeset
for help on using the changeset viewer.