Changeset 77 for trunk/Forms/UFormContacts.pas
- Timestamp:
- Dec 15, 2021, 9:03:17 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormContacts.pas
r76 r77 80 80 procedure FilterList(List: TFPGObjectList<TObject>); 81 81 procedure SetContacts(AValue: TContacts); 82 procedure FormContactPrevious(Sender: TObject);83 procedure FormContactNext(Sender: TObject);82 function GetPreviousContact(Contact: TContact): TContact; 83 function GetNextContact(Contact: TContact): TContact; 84 84 procedure DoUpdateInterface; 85 85 procedure UpdateColumns; … … 234 234 end; 235 235 236 procedure TFormContacts.FormContactPrevious(Sender: TObject);237 var 238 I: Integer; 239 begin 240 I := ListViewSort1.List.IndexOf( TFormContact(Sender).Contact);236 function TFormContacts.GetPreviousContact(Contact: TContact): TContact; 237 var 238 I: Integer; 239 begin 240 I := ListViewSort1.List.IndexOf(Contact); 241 241 if (I <> -1) and (I > 0) then 242 TFormContact(Sender).Contact := TContact(ListViewSort1.List[I - 1]); 243 end; 244 245 procedure TFormContacts.FormContactNext(Sender: TObject); 246 var 247 I: Integer; 248 begin 249 I := ListViewSort1.List.IndexOf(TFormContact(Sender).Contact); 242 Result := TContact(ListViewSort1.List[I - 1]) 243 else Result := nil; 244 end; 245 246 function TFormContacts.GetNextContact(Contact: TContact): TContact; 247 var 248 I: Integer; 249 begin 250 I := ListViewSort1.List.IndexOf(Contact); 250 251 if (I <> -1) and (I < ListViewSort1.List.Count - 1) then 251 TFormContact(Sender).Contact := TContact(ListViewSort1.List[I + 1]); 252 Result := TContact(ListViewSort1.List[I + 1]) 253 else Result := nil; 252 254 end; 253 255 … … 312 314 Contact.Parent := Contacts.ContactsFile; 313 315 FormContact.Contact := Contact; 314 FormContact.On Previous := FormContactPrevious;315 FormContact.On Next := FormContactNext;316 FormContact.OnGetPrevious := GetPreviousContact; 317 FormContact.OnGetNext := GetNextContact; 316 318 if FormContact.ShowModal = mrOK then begin 317 319 Contacts.Add(Contact); … … 342 344 Contact.Assign(TContact(ListView1.Selected.Data)); 343 345 FormContact.Contact := Contact; 344 FormContact.On Previous := FormContactPrevious;345 FormContact.On Next := FormContactNext;346 FormContact.OnGetPrevious := GetPreviousContact; 347 FormContact.OnGetNext := GetNextContact; 346 348 if FormContact.ShowModal = mrOK then begin 347 349 Contacts.Add(Contact); … … 443 445 Contact.Assign(TContact(ListView1.Selected.Data)); 444 446 FormContact.Contact := Contact; 445 FormContact.On Previous := FormContactPrevious;446 FormContact.On Next := FormContactNext;447 FormContact.OnGetPrevious := GetPreviousContact; 448 FormContact.OnGetNext := GetNextContact; 447 449 if FormContact.ShowModal = mrOK then begin 448 450 TContact(ListView1.Selected.Data).Assign(Contact);
Note:
See TracChangeset
for help on using the changeset viewer.