Changeset 2 for trunk/Forms
- Timestamp:
- Jan 26, 2018, 11:23:26 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:ignore
set to
*.lrj
heaptrclog.trc
lib
vCardStudio
*.lps
*.res
-
Property svn:ignore
set to
-
trunk/Forms
-
Property svn:ignore
set to
*.lrj
-
Property svn:ignore
set to
-
trunk/Forms/UFormContacts.lfm
r1 r2 7 7 ClientHeight = 605 8 8 ClientWidth = 807 9 OnClose = FormClose 9 10 OnShow = FormShow 10 11 LCLVersion = '1.8.0.4' 11 12 object ListView1: TListView 12 13 Left = 0 13 Height = 60514 Height = 579 14 15 Top = 0 15 16 Width = 807 … … 21 22 end> 22 23 OwnerData = True 24 PopupMenu = PopupMenuContact 23 25 ReadOnly = True 24 26 RowSelect = True … … 26 28 ViewStyle = vsReport 27 29 OnData = ListView1Data 30 OnDblClick = ListView1DblClick 31 OnSelectItem = ListView1SelectItem 32 end 33 object ToolBar1: TToolBar 34 Left = 0 35 Height = 26 36 Top = 579 37 Width = 807 38 Align = alBottom 39 Caption = 'ToolBar1' 40 Images = Core.ImageList1 41 TabOrder = 1 42 object ToolButton1: TToolButton 43 Left = 1 44 Top = 2 45 Action = AAdd 46 end 47 object ToolButton2: TToolButton 48 Left = 24 49 Top = 2 50 Action = AModify 51 end 52 object ToolButton3: TToolButton 53 Left = 47 54 Top = 2 55 Action = ARemove 56 end 57 end 58 object PopupMenuContact: TPopupMenu 59 Images = Core.ImageList1 60 left = 290 61 top = 175 62 object MenuItem1: TMenuItem 63 Action = AAdd 64 end 65 object MenuItem2: TMenuItem 66 Action = AModify 67 end 68 object MenuItem3: TMenuItem 69 Action = ARemove 70 end 71 end 72 object ActionList1: TActionList 73 Images = Core.ImageList1 74 left = 488 75 top = 171 76 object AAdd: TAction 77 Caption = 'Add' 78 ImageIndex = 9 79 OnExecute = AAddExecute 80 ShortCut = 45 81 end 82 object AModify: TAction 83 Caption = 'Modify' 84 ImageIndex = 6 85 OnExecute = AModifyExecute 86 ShortCut = 13 87 end 88 object ARemove: TAction 89 Caption = 'Remove' 90 ImageIndex = 10 91 OnExecute = ARemoveExecute 92 ShortCut = 46 93 end 28 94 end 29 95 end -
trunk/Forms/UFormContacts.pas
r1 r2 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ComCtrls, UContact;9 ComCtrls, Menus, ActnList, UContact; 10 10 11 11 type … … 14 14 15 15 TFormContacts = class(TForm) 16 AAdd: TAction; 17 ARemove: TAction; 18 AModify: TAction; 19 ActionList1: TActionList; 16 20 ListView1: TListView; 21 MenuItem1: TMenuItem; 22 MenuItem2: TMenuItem; 23 MenuItem3: TMenuItem; 24 PopupMenuContact: TPopupMenu; 25 ToolBar1: TToolBar; 26 ToolButton1: TToolButton; 27 ToolButton2: TToolButton; 28 ToolButton3: TToolButton; 29 procedure AAddExecute(Sender: TObject); 30 procedure AModifyExecute(Sender: TObject); 31 procedure ARemoveExecute(Sender: TObject); 32 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 17 33 procedure FormShow(Sender: TObject); 18 34 procedure ListView1Data(Sender: TObject; Item: TListItem); 35 procedure ListView1DblClick(Sender: TObject); 36 procedure ListView1SelectItem(Sender: TObject; Item: TListItem; 37 Selected: Boolean); 19 38 private 20 39 … … 22 41 Contacts: TContacts; 23 42 procedure ReloadList; 43 procedure UpdateInterface; 24 44 end; 25 45 … … 27 47 FormContacts: TFormContacts; 28 48 49 29 50 implementation 30 51 31 52 {$R *.lfm} 53 54 uses 55 UFormContact, UCore; 32 56 33 57 { TFormContacts } … … 42 66 end; 43 67 68 procedure TFormContacts.ListView1DblClick(Sender: TObject); 69 begin 70 AModify.Execute; 71 end; 72 73 procedure TFormContacts.ListView1SelectItem(Sender: TObject; Item: TListItem; 74 Selected: Boolean); 75 begin 76 UpdateInterface; 77 end; 78 44 79 procedure TFormContacts.FormShow(Sender: TObject); 45 80 begin 81 Core.PersistentForm1.Load(Self); 46 82 ReloadList; 83 UpdateInterface; 84 end; 85 86 procedure TFormContacts.AAddExecute(Sender: TObject); 87 var 88 FormContact: TFormContact; 89 begin 90 FormContact := TFormContact.Create(nil); 91 if FormContact.ShowModal = mrOK then begin 92 FormContact.SaveData(TContact(ListView1.Selected.Data)); 93 ReloadList; 94 UpdateInterface; 95 end; 96 FormContact.Free; 97 end; 98 99 procedure TFormContacts.AModifyExecute(Sender: TObject); 100 var 101 FormContact: TFormContact; 102 begin 103 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; 109 end; 110 FormContact.Free; 111 end; 112 113 procedure TFormContacts.ARemoveExecute(Sender: TObject); 114 var 115 I: Integer; 116 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; 122 end; 123 124 procedure TFormContacts.FormClose(Sender: TObject; var CloseAction: TCloseAction 125 ); 126 begin 127 Core.PersistentForm1.Save(Self); 47 128 end; 48 129 … … 55 136 end; 56 137 138 procedure TFormContacts.UpdateInterface; 139 begin 140 AModify.Enabled := Assigned(ListView1.Selected); 141 ARemove.Enabled := Assigned(ListView1.Selected); 142 end; 143 57 144 end. 58 145
Note:
See TracChangeset
for help on using the changeset viewer.