Ignore:
Timestamp:
Jan 18, 2015, 5:25:37 PM (10 years ago)
Author:
chronos
Message:
  • Added: Support for editing String and DateTime value types in record edit form.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        33MyData.lps
        44data.xml
         5Config.xml
  • trunk/Forms/UFormField.pas

    r2 r3  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   UDatabase;
     9  ComCtrls, EditBtn, UDatabase;
    1010
    1111type
     
    1717    ButtonCancel: TButton;
    1818    ComboBoxType: TComboBox;
     19    DateEditMin: TDateEdit;
     20    DateEditMax: TDateEdit;
    1921    EditName: TEdit;
     22    EditStringDefault: TEdit;
    2023    EditTextBefore: TEdit;
    2124    EditTextAfter: TEdit;
     
    2427    Label3: TLabel;
    2528    Label4: TLabel;
     29    Label5: TLabel;
     30    Label6: TLabel;
     31    Label7: TLabel;
     32    PageControl1: TPageControl;
     33    TabSheetDateTime: TTabSheet;
     34    TabSheetInteger: TTabSheet;
     35    TabSheetString: TTabSheet;
     36    TabSheetBoolean: TTabSheet;
     37    procedure ComboBoxTypeChange(Sender: TObject);
    2638    procedure FormCreate(Sender: TObject);
    2739    procedure FormShow(Sender: TObject);
     
    5567end;
    5668
     69procedure TFormField.ComboBoxTypeChange(Sender: TObject);
     70begin
     71  PageControl1.TabIndex := ComboBoxType.ItemIndex;
     72end;
     73
    5774procedure TFormField.Load(Field: TField);
    5875begin
     
    6178  EditTextBefore.Text := Field.TextBefore;
    6279  ComboBoxType.ItemIndex := Integer(Field.FieldType);
     80  ComboBoxTypeChange(Self);
     81  if Field.FieldType = ftString then
     82    EditStringDefault.Text := TFieldString(Field.TypeRelated).DefaultValue;
     83  if Field.FieldType = ftDateTime then begin
     84    DateEditMin.Date := TFieldDateTime(Field.TypeRelated).Min;
     85    DateEditMax.Date := TFieldDateTime(Field.TypeRelated).Max;
     86  end;
    6387end;
    6488
     
    6993  Field.TextAfter := EditTextAfter.Text;
    7094  Field.FieldType := TFieldType(ComboBoxType.ItemIndex);
     95  if Field.FieldType = ftString then
     96    TFieldString(Field.TypeRelated).DefaultValue := EditStringDefault.Text;
     97  if Field.FieldType = ftDateTime then begin
     98    TFieldDateTime(Field.TypeRelated).Min := DateEditMin.Date;
     99    TFieldDateTime(Field.TypeRelated).Max := DateEditMax.Date;
     100  end;
    71101end;
    72102
Note: See TracChangeset for help on using the changeset viewer.