Ignore:
Timestamp:
Feb 1, 2018, 12:51:32 PM (7 years ago)
Author:
chronos
Message:
  • Added: Show all fields tab in contact form.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContact.pas

    r7 r8  
    3636    procedure FormCreate(Sender: TObject);
    3737    procedure FormShow(Sender: TObject);
     38    procedure ListView1Data(Sender: TObject; Item: TListItem);
    3839  private
    39 
     40    Contact: TContact;
    4041  public
     42    procedure ReloadFields;
    4143    procedure LoadData(Contact: TContact);
    4244    procedure SaveData(Contact: TContact);
     
    5860begin
    5961  Core.PersistentForm1.Load(Self);
     62  PageControlContact.TabIndex := 0;
     63  ReloadFields;
     64end;
     65
     66procedure TFormContact.ListView1Data(Sender: TObject; Item: TListItem);
     67begin
     68  if Item.Index < Contact.Parent.Fields.Count then
     69  with TContactField(Contact.Parent.Fields[Item.Index]) do begin
     70    Item.Caption := Name;
     71    Item.SubItems.Add(Contact.Fields[Index]);
     72  end;
     73end;
     74
     75procedure TFormContact.ReloadFields;
     76begin
     77  if Assigned(Contact) then begin
     78    ListView1.Items.Count := Contact.Parent.Fields.Count;
     79  end else ListView1.Items.Count := 0;
     80  ListView1.Refresh;
    6081end;
    6182
     
    6990begin
    7091  Core.CoolTranslator1.TranslateComponentRecursive(Self);
     92  Contact := nil;
    7193end;
    7294
    7395procedure TFormContact.LoadData(Contact: TContact);
    7496begin
     97  Self.Contact := Contact;
     98  ReloadFields;
    7599  EditName.Text := Contact.FirstName;
    76100  EditSurname.Text := Contact.LastName;
Note: See TracChangeset for help on using the changeset viewer.