Changeset 33 for trunk/Forms/UFormImportSource.pas
- Timestamp:
- Jul 13, 2016, 2:51:53 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormImportSource.pas
r29 r33 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 UAcronym;9 ActnList, Menus, ExtCtrls, UAcronym; 10 10 11 11 type … … 14 14 15 15 TFormImportSource = class(TForm) 16 ACategoryAdd: TAction; 17 ACategoryRemove: TAction; 18 ActionList1: TActionList; 19 Bevel1: TBevel; 20 Button1: TButton; 21 Button2: TButton; 16 22 ButtonShowFormat: TButton; 17 23 ButtonOk: TButton; … … 24 30 Label2: TLabel; 25 31 Label3: TLabel; 32 Label4: TLabel; 33 ListBox1: TListBox; 34 MenuItem1: TMenuItem; 35 MenuItem2: TMenuItem; 36 PopupMenuCategory: TPopupMenu; 37 procedure ACategoryAddExecute(Sender: TObject); 38 procedure ACategoryRemoveExecute(Sender: TObject); 26 39 procedure ButtonShowFormatClick(Sender: TObject); 40 procedure FormShow(Sender: TObject); 27 41 private 28 42 { private declarations } 29 43 public 44 procedure UpdateInterface; 30 45 procedure Load(ImportSource: TImportSource); 31 46 procedure Save(ImportSource: TImportSource); … … 40 55 41 56 uses 42 UFormMain, UFormImportFormat ;57 UFormMain, UFormImportFormat, UFormCategorySelect; 43 58 44 59 { TFormImportSource } … … 62 77 end; 63 78 79 procedure TFormImportSource.FormShow(Sender: TObject); 80 begin 81 UpdateInterface; 82 end; 83 84 procedure TFormImportSource.UpdateInterface; 85 begin 86 ACategoryRemove.Enabled := ListBox1.ItemIndex <> -1; 87 end; 88 89 procedure TFormImportSource.ACategoryAddExecute(Sender: TObject); 90 var 91 I: Integer; 92 begin 93 FormCategorySelect.Load(ListBox1.Items); 94 if FormCategorySelect.ShowModal = mrOk then begin 95 for I := 0 to FormCategorySelect.ListBox1.Count - 1 do 96 if FormCategorySelect.ListBox1.Selected[I] then begin 97 ListBox1.Items.AddObject(FormCategorySelect.ListBox1.Items[I], FormCategorySelect.ListBox1.Items.Objects[I]); 98 end; 99 end; 100 end; 101 102 procedure TFormImportSource.ACategoryRemoveExecute(Sender: TObject); 103 var 104 I: Integer; 105 begin 106 if MessageDlg(SRemoveCategory, SRemoveCategoryQuery, 107 TMsgDlgType.mtConfirmation, [mbCancel, mbOk], 0) = mrOk then begin 108 for I := ListBox1.Items.Count - 1 downto 0 do 109 if ListBox1.Selected[I] then 110 ListBox1.Items.Delete(I); 111 UpdateInterface; 112 end; 113 end; 114 64 115 procedure TFormImportSource.Load(ImportSource: TImportSource); 65 116 var … … 80 131 ComboBox1.ItemIndex := 0; 81 132 CheckBoxEnabled.Checked := ImportSource.Enabled; 133 ImportSource.Categories.AssignToStrings(ListBox1.Items); 82 134 end; 83 135 … … 88 140 ImportSource.Format := TImportFormat(ComboBox1.Items.Objects[ComboBox1.ItemIndex]); 89 141 ImportSource.Enabled := CheckBoxEnabled.Checked; 142 ImportSource.Categories.AssignFromStrings(ListBox1.Items); 90 143 end; 91 144
Note:
See TracChangeset
for help on using the changeset viewer.