Changeset 51 for trunk/Forms/UFormProperties.pas
- Timestamp:
- Dec 3, 2021, 7:44:05 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormProperties.pas
r42 r51 15 15 TFormProperties = class(TForm) 16 16 AAdd: TAction; 17 AClone: TAction; 17 18 ASelectAll: TAction; 18 19 ARemove: TAction; … … 26 27 MenuItem3: TMenuItem; 27 28 MenuItem4: TMenuItem; 29 MenuItem5: TMenuItem; 28 30 PopupMenuField: TPopupMenu; 29 31 StatusBar1: TStatusBar; … … 33 35 ToolButton3: TToolButton; 34 36 procedure AAddExecute(Sender: TObject); 37 procedure ACloneExecute(Sender: TObject); 35 38 procedure AModifyExecute(Sender: TObject); 36 39 procedure ARemoveExecute(Sender: TObject); … … 78 81 79 82 procedure TFormProperties.ListView1Data(Sender: TObject; Item: TListItem); 83 84 procedure AddItem(Text: string; IsCaption: Boolean = False); 85 begin 86 if IsCaption then begin 87 if Text <> '' then Item.Caption := Text 88 else Item.Caption := ' '; 89 end else begin 90 if Text <> '' then Item.SubItems.Add(Text) 91 else Item.SubItems.Add(' '); 92 end; 93 end; 94 80 95 begin 81 96 if Item.Index < ListViewSort1.List.Count then 82 97 with TContactProperty(ListViewSort1.List[Item.Index]) do begin 83 Item.Caption := Name;84 Item.SubItems.Add(Attributes.DelimitedText);85 Item.SubItems.Add(Value);98 AddItem(Name, True); 99 AddItem(Attributes.DelimitedText); 100 AddItem(Value); 86 101 Item.Data := ListViewSort1.List[Item.Index]; 87 102 end; … … 204 219 end; 205 220 221 procedure TFormProperties.ACloneExecute(Sender: TObject); 222 var 223 FormProperty: TFormProperty; 224 ContactProperty: TContactProperty; 225 begin 226 FormProperty := TFormProperty.Create(nil); 227 try 228 ContactProperty := TContactProperty.Create; 229 ContactProperty.Assign(TContactProperty(ListView1.Selected.Data)); 230 FormProperty.ContactProperty := ContactProperty; 231 try 232 if FormProperty.ShowModal = mrOK then begin 233 Properties.Add(ContactProperty); 234 ContactProperty := nil; 235 Core.DataFile.Modified := True; 236 ReloadList; 237 UpdateInterface; 238 end; 239 finally 240 if Assigned(ContactProperty) then 241 ContactProperty.Free; 242 end; 243 finally 244 FormProperty.Free; 245 end; 246 end; 247 206 248 procedure TFormProperties.AModifyExecute(Sender: TObject); 207 249 var
Note:
See TracChangeset
for help on using the changeset viewer.