Changeset 4 for trunk/Forms/UFormRecord.pas
- Timestamp:
- Jan 18, 2015, 11:29:26 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormRecord.pas
r3 r4 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, 9 ComCtrls, ActnList, StdCtrls, EditBtn, UDatabase, Contnrs ;9 ComCtrls, ActnList, StdCtrls, EditBtn, UDatabase, Contnrs, Spin; 10 10 11 11 type … … 42 42 implementation 43 43 44 uses 45 UDataTypes; 46 44 47 {$R *.lfm} 45 48 … … 48 51 procedure TFormRecord.FormShow(Sender: TObject); 49 52 begin 53 Caption := 'Table record edit - ' + Table.Caption; 50 54 ReloadControls; 51 55 end; … … 54 58 begin 55 59 ModalResult := mrCancel; 56 Close;57 60 end; 58 61 … … 60 63 begin 61 64 ModalResult := mrOk; 62 Close;63 65 end; 64 66 … … 109 111 Controls.Add(NewControl); 110 112 end; 113 ftInteger: begin 114 NewControl := TSpinEdit.Create(Panel1); 115 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.Visible := True; 120 TSpinEdit(NewControl).Value := TValueInteger(Row.Values[I]).Value; 121 Controls.Add(NewControl); 122 end; 111 123 ftDateTime: begin 112 124 NewControl := TDateEdit.Create(Panel1); … … 117 129 NewControl.Visible := True; 118 130 TDateEdit(NewControl).Date := TValueDateTime(Row.Values[I]).Value; 131 Controls.Add(NewControl); 132 end; 133 ftBoolean: begin 134 NewControl := TCheckBox.Create(Panel1); 135 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.Visible := True; 140 TCheckBox(NewControl).Checked := TValueBoolean(Row.Values[I]).Value; 119 141 Controls.Add(NewControl); 120 142 end; … … 130 152 case TField(Table.Fields[I]).FieldType of 131 153 ftString: TValueString(Row.Values[I]).Value := TEdit(Controls[I]).Text; 154 ftInteger: TValueInteger(Row.Values[I]).Value := TSpinEdit(Controls[I]).Value; 132 155 ftDateTime: TValueDateTime(Row.Values[I]).Value := TDateEdit(Controls[I]).Date; 156 ftBoolean: TValueBoolean(Row.Values[I]).Value := TCheckBox(Controls[I]).Checked; 133 157 end; 134 158 end;
Note:
See TracChangeset
for help on using the changeset viewer.