Changeset 68 for trunk/Forms


Ignore:
Timestamp:
Dec 10, 2021, 11:15:41 AM (2 years ago)
Author:
chronos
Message:
  • Fixed: Wrong field selected for duplicates find from field combobox selection in Find duplicates window.
  • Added: Sort list of contact fields in Find duplicates and Field windows.
Location:
trunk/Forms
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormFindDuplicity.pas

    r29 r68  
    4949  public
    5050    FoundItems: TFoundItems;
    51     ContactField: TContactFieldIndex;
     51    ContactFieldIndex: TContactFieldIndex;
    5252    procedure Find;
    5353    procedure ReloadList;
     
    107107
    108108procedure TFormFindDuplicity.SetContacts(AValue: TContacts);
     109var
     110  ContactField: TContactField;
    109111begin
    110112  if FContacts = AValue then Exit;
     
    112114  if Assigned(FContacts) then begin
    113115    Contacts.ContactsFile.Fields.LoadToStrings(ComboBoxField.Items);
    114     ComboBoxField.ItemIndex := Integer(ContactField);
     116    ContactField := Contacts.ContactsFile.Fields.GetByIndex(ContactFieldIndex);
     117    ComboBoxField.ItemIndex := ComboBoxField.Items.IndexOfObject(ContactField);
    115118    if (ComboBoxField.Items.Count > 0) and (ComboBoxField.ItemIndex = -1) then
    116119      ComboBoxField.ItemIndex := 0;
     
    133136  FoundItems.Clear;
    134137  for I := 0 to Contacts.Count - 1 do begin
    135     FieldName := TContact(Contacts[I]).Fields[ContactField];
     138    FieldName := Contacts[I].Fields[ContactFieldIndex];
    136139    if FieldName <> '' then begin
    137140      Item := FoundItems.SearchByField(FieldName);
     
    153156  Core.Translator.TranslateComponentRecursive(Self);
    154157  Core.ThemeManager1.UseTheme(Self);
    155   ContactField := cfTelCell;
     158  ContactFieldIndex := cfTelCell;
    156159end;
    157160
    158161procedure TFormFindDuplicity.ComboBoxFieldChange(Sender: TObject);
    159162begin
    160   ContactField := TContactFieldIndex(ComboBoxField.ItemIndex);
     163  if ComboBoxField.ItemIndex <> -1 then
     164    ContactFieldIndex := TContactField(ComboBoxField.Items.Objects[ComboBoxField.ItemIndex]).Index
     165    else ContactFieldIndex := cfTelCell;
    161166  Find;
    162167end;
  • trunk/Forms/UFormProperty.lfm

    r56 r68  
    9595  object ComboBoxField: TComboBox
    9696    Left = 168
    97     Height = 42
     97    Height = 41
    9898    Top = 24
    9999    Width = 532
  • trunk/Forms/UFormProperty.pas

    r56 r68  
    6464begin
    6565  if ComboBoxField.ItemIndex <> -1 then begin
    66     Field := TContactsFile(Core.DataFile).Fields[ComboBoxField.ItemIndex];
     66    Field := TContactField(ComboBoxField.Items.Objects[ComboBoxField.ItemIndex]);
    6767    if Assigned(Field) then begin
    6868      EditName.Text := Field.SysName;
     
    132132    GroupsArray);
    133133  if Assigned(Field) then
    134     ComboBoxField.ItemIndex := TContactsFile(Core.DataFile).Fields.IndexOf(Field);
     134    ComboBoxField.ItemIndex := ComboBoxField.Items.IndexOfObject(Field);
    135135end;
    136136
Note: See TracChangeset for help on using the changeset viewer.