Changeset 3 for trunk/Forms
- Timestamp:
- Jan 29, 2018, 10:54:40 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 5 5 *.lps 6 6 *.res 7 vCardStudio.exe
-
- Property svn:ignore
-
trunk/Forms/UFormContact.lfm
r2 r3 1 1 object FormContact: TFormContact 2 Left = 5952 Left = 423 3 3 Height = 490 4 Top = 5414 Top = 271 5 5 Width = 762 6 6 Caption = 'Contact' 7 7 ClientHeight = 490 8 8 ClientWidth = 762 9 LCLVersion = '1.8.0.4' 9 DesignTimePPI = 120 10 LCLVersion = '1.8.0.6' 10 11 object PageControlContact: TPageControl 11 12 Left = 8 … … 19 20 object TabSheetGeneral: TTabSheet 20 21 Caption = 'General' 21 ClientHeight = 3 8022 ClientWidth = 73 822 ClientHeight = 391 23 ClientWidth = 736 23 24 object Label1: TLabel 24 25 Left = 13 25 Height = 2 626 Height = 20 26 27 Top = 13 27 Width = 5628 Width = 43 28 29 Caption = 'Name:' 29 30 ParentColor = False … … 31 32 object EditName: TEdit 32 33 Left = 100 33 Height = 3634 Height = 28 34 35 Top = 15 35 36 Width = 212 36 37 TabOrder = 0 38 end 39 object Label2: TLabel 40 Left = 13 41 Height = 20 42 Top = 47 43 Width = 74 44 Caption = 'Cell phone:' 45 ParentColor = False 46 end 47 object EditCellPhone: TEdit 48 Left = 100 49 Height = 28 50 Top = 49 51 Width = 212 52 TabOrder = 1 53 end 54 object EditPhone: TEdit 55 Left = 100 56 Height = 28 57 Top = 83 58 Width = 212 59 TabOrder = 2 60 end 61 object Label3: TLabel 62 Left = 13 63 Height = 20 64 Top = 81 65 Width = 44 66 Caption = 'Phone:' 67 ParentColor = False 68 end 69 object EditEmail: TEdit 70 Left = 479 71 Height = 28 72 Top = 49 73 Width = 212 74 TabOrder = 3 75 end 76 object Label4: TLabel 77 Left = 392 78 Height = 20 79 Top = 47 80 Width = 46 81 Caption = 'E-mail:' 82 ParentColor = False 83 end 84 object EditSurname: TEdit 85 Left = 479 86 Height = 28 87 Top = 15 88 Width = 212 89 TabOrder = 4 90 end 91 object Label5: TLabel 92 Left = 392 93 Height = 20 94 Top = 13 95 Width = 61 96 Caption = 'Surname:' 97 ParentColor = False 98 end 99 object MemoNotes: TMemo 100 Left = 13 101 Height = 225 102 Top = 152 103 Width = 708 104 Anchors = [akTop, akLeft, akRight, akBottom] 105 TabOrder = 5 106 end 107 object Label6: TLabel 108 Left = 12 109 Height = 20 110 Top = 126 111 Width = 42 112 Caption = 'Notes:' 113 ParentColor = False 37 114 end 38 115 end … … 42 119 object TabSheetAll: TTabSheet 43 120 Caption = 'All fields' 121 ClientHeight = 391 122 ClientWidth = 736 123 object ListView1: TListView 124 Left = 8 125 Height = 344 126 Top = 16 127 Width = 721 128 Anchors = [akTop, akLeft, akRight, akBottom] 129 Columns = < 130 item 131 Caption = 'Item' 132 Width = 200 133 end 134 item 135 Caption = 'Value' 136 Width = 200 137 end> 138 ReadOnly = True 139 RowSelect = True 140 TabOrder = 0 141 ViewStyle = vsReport 142 end 44 143 end 45 144 end -
trunk/Forms/UFormContact.pas
r2 r3 16 16 ButtonCancel: TButton; 17 17 ButtonOk: TButton; 18 EditSurname: TEdit; 19 EditEmail: TEdit; 20 EditPhone: TEdit; 18 21 EditName: TEdit; 22 EditCellPhone: TEdit; 19 23 Label1: TLabel; 24 Label2: TLabel; 25 Label3: TLabel; 26 Label4: TLabel; 27 Label5: TLabel; 28 Label6: TLabel; 29 ListView1: TListView; 30 MemoNotes: TMemo; 20 31 PageControlContact: TPageControl; 21 32 TabSheetGeneral: TTabSheet; … … 41 52 begin 42 53 EditName.Text := Contact.FirstName; 54 EditSurname.Text := Contact.LastName; 55 EditCellPhone.Text := Contact.TelCell; 56 EditPhone.Text := Contact.TelHome; 57 EditEmail.Text := Contact.EmailHome; 58 MemoNotes.Lines.Text := Contact.Note; 43 59 end; 44 60 … … 46 62 begin 47 63 Contact.FirstName := EditName.Text; 64 Contact.LastName := EditSurname.Text; 65 Contact.TelCell := EditCellPhone.Text; 66 Contact.TelHome := EditPhone.Text; 67 Contact.EmailHome := EditEmail.Text; 68 Contact.Note := MemoNotes.Lines.Text; 48 69 end; 49 70 -
trunk/Forms/UFormContacts.lfm
r2 r3 7 7 ClientHeight = 605 8 8 ClientWidth = 807 9 DesignTimePPI = 120 9 10 OnClose = FormClose 11 OnCreate = FormCreate 10 12 OnShow = FormShow 11 LCLVersion = '1.8.0. 4'13 LCLVersion = '1.8.0.6' 12 14 object ListView1: TListView 13 15 Left = 0 … … 18 20 Columns = < 19 21 item 20 Caption = 'Name' 21 Width = 787 22 Caption = 'First name' 23 Width = 100 24 end 25 item 26 Caption = 'Middle name' 27 Width = 100 28 end 29 item 30 Caption = 'Last Name' 31 Width = 100 22 32 end> 23 33 OwnerData = True -
trunk/Forms/UFormContacts.pas
r2 r3 31 31 procedure ARemoveExecute(Sender: TObject); 32 32 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 33 procedure FormCreate(Sender: TObject); 33 34 procedure FormShow(Sender: TObject); 34 35 procedure ListView1Data(Sender: TObject; Item: TListItem); … … 37 38 Selected: Boolean); 38 39 private 40 FContacts: TContacts; 41 procedure SetContacts(AValue: TContacts); 39 42 40 43 public 41 Contacts: TContacts;44 property Contacts: TContacts read FContacts write SetContacts; 42 45 procedure ReloadList; 43 46 procedure UpdateInterface; … … 55 58 UFormContact, UCore; 56 59 60 resourcestring 61 SRemoveContacts = 'Remove contacts'; 62 SRemoveContactsQuery = 'Do you want to remove selected contacts?'; 63 57 64 { TFormContacts } 58 65 … … 61 68 if Assigned(Contacts) and (Item.Index < Contacts.Count) then 62 69 with TContact(Contacts[Item.Index]) do begin 63 Item.Caption := FullName; 70 Item.Caption := FirstName; 71 Item.SubItems.Add(MiddleName); 72 Item.SubItems.Add(LastName); 64 73 Item.Data := Contacts[Item.Index]; 65 74 end; … … 77 86 end; 78 87 88 procedure TFormContacts.SetContacts(AValue: TContacts); 89 begin 90 if FContacts = AValue then Exit; 91 FContacts := AValue; 92 ReloadList; 93 UpdateInterface; 94 end; 95 79 96 procedure TFormContacts.FormShow(Sender: TObject); 80 97 begin … … 87 104 var 88 105 FormContact: TFormContact; 106 Contact: TContact; 89 107 begin 90 108 FormContact := TFormContact.Create(nil); 109 try 91 110 if FormContact.ShowModal = mrOK then begin 92 FormContact.SaveData(TContact(ListView1.Selected.Data)); 111 Contact := TContact.Create; 112 FormContact.SaveData(Contact); 113 Contacts.Add(Contact); 114 Core.DataFile.Modified := True; 93 115 ReloadList; 94 116 UpdateInterface; 95 117 end; 96 FormContact.Free; 118 finally 119 FormContact.Free; 120 end; 97 121 end; 98 122 … … 102 126 begin 103 127 FormContact := TFormContact.Create(nil); 104 FormContact.LoadData(TContact(ListView1.Selected.Data)); 105 if FormContact.ShowModal = mrOK then begin 106 FormContact.SaveData(TContact(ListView1.Selected.Data)); 107 ReloadList; 108 UpdateInterface; 128 try 129 FormContact.LoadData(TContact(ListView1.Selected.Data)); 130 if FormContact.ShowModal = mrOK then begin 131 FormContact.SaveData(TContact(ListView1.Selected.Data)); 132 Core.DataFile.Modified := True; 133 ReloadList; 134 UpdateInterface; 135 end; 136 finally 137 FormContact.Free; 109 138 end; 110 FormContact.Free;111 139 end; 112 140 … … 115 143 I: Integer; 116 144 begin 117 for I := ListView1.Items.Count - 1 downto 0 do 118 if ListView1.Items[I].Selected then begin 119 Contacts.Delete(I); 120 end; 121 UpdateInterface; 145 if Assigned(ListView1.Selected) then 146 if MessageDlg(SRemoveContacts, SRemoveContactsQuery, 147 TMsgDlgType.mtConfirmation, [mbCancel, mbOk], 0) = mrOk then begin 148 for I := ListView1.Items.Count - 1 downto 0 do 149 if ListView1.Items[I].Selected then begin 150 Contacts.Delete(I); 151 end; 152 Core.DataFile.Modified := True; 153 ReloadList; 154 UpdateInterface; 155 end; 122 156 end; 123 157 … … 126 160 begin 127 161 Core.PersistentForm1.Save(Self); 162 end; 163 164 procedure TFormContacts.FormCreate(Sender: TObject); 165 begin 166 FContacts := nil; 128 167 end; 129 168 … … 138 177 procedure TFormContacts.UpdateInterface; 139 178 begin 140 AModify.Enabled := Assigned(ListView1.Selected); 141 ARemove.Enabled := Assigned(ListView1.Selected); 179 AAdd.Enabled := Assigned(Contacts); 180 AModify.Enabled := Assigned(Contacts) and Assigned(ListView1.Selected); 181 ARemove.Enabled := Assigned(Contacts) and Assigned(ListView1.Selected); 142 182 end; 143 183
Note:
See TracChangeset
for help on using the changeset viewer.