Changeset 8 for trunk/Forms


Ignore:
Timestamp:
Feb 1, 2018, 12:51:32 PM (6 years ago)
Author:
chronos
Message:
  • Added: Show all fields tab in contact form.
Location:
trunk/Forms
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContact.lfm

    r7 r8  
    77  ClientHeight = 490
    88  ClientWidth = 762
     9  DesignTimePPI = 120
    910  OnClose = FormClose
    1011  OnCreate = FormCreate
    1112  OnShow = FormShow
    12   LCLVersion = '1.8.0.4'
     13  LCLVersion = '1.8.0.6'
    1314  object PageControlContact: TPageControl
    1415    Left = 8
     
    1617    Top = 8
    1718    Width = 744
    18     ActivePage = TabSheetGeneral
     19    ActivePage = TabSheetAll
    1920    Anchors = [akTop, akLeft, akRight, akBottom]
    20     TabIndex = 0
     21    TabIndex = 2
    2122    TabOrder = 0
    2223    object TabSheetGeneral: TTabSheet
    2324      Caption = 'General'
    24       ClientHeight = 380
    25       ClientWidth = 738
     25      ClientHeight = 391
     26      ClientWidth = 736
    2627      object Label1: TLabel
    2728        Left = 13
    28         Height = 26
     29        Height = 20
    2930        Top = 13
    30         Width = 56
     31        Width = 43
    3132        Caption = 'Name:'
    3233        ParentColor = False
     
    3435      object EditName: TEdit
    3536        Left = 100
    36         Height = 36
     37        Height = 28
    3738        Top = 15
    3839        Width = 212
     
    4142      object Label2: TLabel
    4243        Left = 13
    43         Height = 26
     44        Height = 20
    4445        Top = 47
    45         Width = 95
     46        Width = 74
    4647        Caption = 'Cell phone:'
    4748        ParentColor = False
     
    4950      object EditCellPhone: TEdit
    5051        Left = 100
    51         Height = 36
     52        Height = 28
    5253        Top = 49
    5354        Width = 212
     
    5657      object EditPhone: TEdit
    5758        Left = 100
    58         Height = 36
     59        Height = 28
    5960        Top = 83
    6061        Width = 212
     
    6364      object Label3: TLabel
    6465        Left = 13
    65         Height = 26
     66        Height = 20
    6667        Top = 81
    67         Width = 59
     68        Width = 44
    6869        Caption = 'Phone:'
    6970        ParentColor = False
     
    7172      object EditEmail: TEdit
    7273        Left = 479
    73         Height = 36
     74        Height = 28
    7475        Top = 49
    7576        Width = 212
     
    7879      object Label4: TLabel
    7980        Left = 392
    80         Height = 26
     81        Height = 20
    8182        Top = 47
    82         Width = 58
     83        Width = 46
    8384        Caption = 'E-mail:'
    8485        ParentColor = False
     
    8687      object EditSurname: TEdit
    8788        Left = 479
    88         Height = 36
     89        Height = 28
    8990        Top = 15
    9091        Width = 212
     
    9394      object Label5: TLabel
    9495        Left = 392
    95         Height = 26
     96        Height = 20
    9697        Top = 13
    97         Width = 81
     98        Width = 61
    9899        Caption = 'Surname:'
    99100        ParentColor = False
     
    101102      object MemoNotes: TMemo
    102103        Left = 13
    103         Height = 214
     104        Height = 225
    104105        Top = 152
    105         Width = 710
     106        Width = 708
    106107        Anchors = [akTop, akLeft, akRight, akBottom]
    107108        TabOrder = 5
     
    109110      object Label6: TLabel
    110111        Left = 12
    111         Height = 26
     112        Height = 20
    112113        Top = 126
    113         Width = 56
     114        Width = 42
    114115        Caption = 'Notes:'
    115116        ParentColor = False
     
    121122    object TabSheetAll: TTabSheet
    122123      Caption = 'All fields'
    123       ClientHeight = 380
    124       ClientWidth = 738
     124      ClientHeight = 391
     125      ClientWidth = 736
    125126      object ListView1: TListView
    126127        Left = 8
    127         Height = 344
     128        Height = 368
    128129        Top = 16
    129130        Width = 721
     
    136137          item
    137138            Caption = 'Value'
    138             Width = 501
     139            Width = 200
    139140          end>
    140141        ReadOnly = True
     
    142143        TabOrder = 0
    143144        ViewStyle = vsReport
     145        OnData = ListView1Data
    144146      end
    145147    end
  • 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;
  • trunk/Forms/UFormContacts.lfm

    r7 r8  
    11object FormContacts: TFormContacts
    2   Left = 536
     2  Left = 400
    33  Height = 605
    4   Top = 418
     4  Top = 212
    55  Width = 807
    66  Caption = 'Contacts'
    77  ClientHeight = 605
    88  ClientWidth = 807
     9  DesignTimePPI = 120
    910  OnClose = FormClose
    1011  OnCreate = FormCreate
    1112  OnShow = FormShow
    12   LCLVersion = '1.8.0.4'
     13  LCLVersion = '1.8.0.6'
    1314  object ListView1: TListView
    1415    Left = 0
     
    2829      item
    2930        Caption = 'Last Name'
    30         Width = 587
     31        Width = 100
    3132      end>
    3233    OwnerData = True
  • trunk/Forms/UFormContacts.pas

    r3 r8  
    110110  if FormContact.ShowModal = mrOK then begin
    111111    Contact := TContact.Create;
     112    Contact.Parent := Contacts.ContactsFile;
    112113    FormContact.SaveData(Contact);
    113114    Contacts.Add(Contact);
     
    171172  if Assigned(Contacts) then
    172173    ListView1.Items.Count := Contacts.Count
    173     else ListView1.Clear;
     174    else ListView1.Items.Count := 0;
    174175  ListView1.Refresh;
    175176end;
  • trunk/Forms/UFormMain.lfm

    r7 r8  
    55  Width = 785
    66  Caption = 'FormMain'
    7   ClientHeight = 497
     7  ClientHeight = 506
    88  ClientWidth = 785
     9  DesignTimePPI = 120
    910  Menu = MainMenu1
    1011  OnClose = FormClose
     
    1213  OnCreate = FormCreate
    1314  OnShow = FormShow
    14   LCLVersion = '1.8.0.4'
     15  LCLVersion = '1.8.0.6'
    1516  object CoolBar1: TCoolBar
    1617    Left = 0
    17     Height = 38
     18    Height = 32
    1819    Top = 0
    1920    Width = 785
  • trunk/Forms/UFormMain.pas

    r1 r8  
    7474procedure TFormMain.FormCloseQuery(Sender: TObject; var CanClose: boolean);
    7575begin
    76   Core.FileClose;
     76  Core.AFileClose.Execute;
    7777  CanClose := Core.FileClosed;
    7878end;
Note: See TracChangeset for help on using the changeset viewer.