Ignore:
Timestamp:
Sep 10, 2022, 10:54:56 PM (2 years ago)
Author:
chronos
Message:
  • Fixed: Load table fields in records list and record edit form.
  • Fixed: Record add needs to insert new row into database.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormRecord.pas

    r28 r29  
    3737
    3838uses
    39   UDataTypes;
     39  UDataTypes, UCore;
    4040
    4141{$R *.lfm}
     
    8686const
    8787  LabelWidth = 300;
    88 begin
     88var
     89  LineHeight: Integer;
     90begin
     91  LineHeight := Core.ScaleDPI1.ScaleY(35, Core.ScaleDPI1.DesignDPI.Y);
     92
    8993  Row := DataRecord;
    9094  Controls.Clear;
    9195  Labels.Clear;
    9296  for I := 0 to Table.Fields.Count - 1 do begin
    93     CellRect := Rect(10, 10 + I * 35, Panel1.Width - 20, (I + 1) * 35);
     97    CellRect := Rect(10, 10 + I * LineHeight, Panel1.Width - 20, (I + 1) * LineHeight);
    9498    NewLabel := TLabel.Create(Panel1);
    95     NewLabel.Caption := TField(Table.Fields[I]).TextBefore;
     99    NewLabel.Caption := Table.Fields[I].TextBefore;
    96100    NewLabel.Parent := Panel1;
    97101    NewLabel.Left := CellRect.Left;
     
    99103    NewLabel.Visible := True;
    100104    Labels.Add(NewLabel);
    101     case TField(Table.Fields[I]).DataType.FieldType of
     105    case Table.Fields[I].DataType.FieldType of
    102106      ftString: begin
    103107        NewControl := TEdit.Create(Panel1);
     
    183187begin
    184188  for I := 0 to Table.Fields.Count - 1 do begin
    185     case TField(Table.Fields[I]).DataType.FieldType of
     189    case Table.Fields[I].DataType.FieldType of
    186190      ftString: TValueString(Row.Values[I]).Value := TEdit(Controls[I]).Text;
    187191      ftInteger: TValueInteger(Row.Values[I]).Value := TSpinEdit(Controls[I]).Value;
Note: See TracChangeset for help on using the changeset viewer.