Changeset 219 for trunk/Forms/FormCategories.pas
- Timestamp:
- Jan 17, 2025, 9:05:54 PM (4 days ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/FormCategories.pas
r218 r219 1 unit UFormCategories; 2 3 {$mode delphi} 1 unit FormCategories; 4 2 5 3 interface … … 7 5 uses 8 6 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls, 9 ActnList, Menus, UAcronym, UListViewSort;7 ActnList, Menus, Acronym, ListViewSort, FormEx; 10 8 11 9 type … … 13 11 { TFormCategories } 14 12 15 TFormCategories = class(TForm )13 TFormCategories = class(TFormEx) 16 14 AAdd: TAction; 17 15 AEnable: TAction; … … 41 39 procedure ARemoveExecute(Sender: TObject); 42 40 procedure ASelectAllExecute(Sender: TObject); 43 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);44 41 procedure FormCreate(Sender: TObject); 45 42 procedure FormShow(Sender: TObject); … … 53 50 function ListViewSort1CompareItem(Item1, Item2: TObject): Integer; 54 51 procedure ListViewSort1Filter(ListViewSort: TListViewSort); 55 private56 { private declarations }57 52 public 58 53 Categories: TAcronymCategories; … … 61 56 end; 62 57 63 var64 FormCategories: TFormCategories;65 58 66 59 implementation … … 69 62 70 63 uses 71 UCore;64 Core; 72 65 73 66 resourcestring … … 82 75 procedure TFormCategories.FormShow(Sender: TObject); 83 76 begin 84 Core.PersistentForm1.Load(Self);85 77 UpdateList; 86 Core. ScaleDPI1.ScaleControl(ToolBar1,Core.ScaleDPI1.DesignDPI);78 Core.Core.ScaleDPI1.ScaleControl(ToolBar1, Core.Core.ScaleDPI1.DesignDPI); 87 79 end; 88 80 … … 92 84 if Assigned(Item) and (Change = ctState) then begin 93 85 TAcronymCategory(Item.Data).Enabled := Item.Checked; 94 Core. AcronymDb.Modified := True;86 Core.Core.AcronymDb.Modified := True; 95 87 end; 96 88 end; … … 102 94 S := InputBox(SCategory, SCategoryQuery, ''); 103 95 if S <> '' then begin 104 if not Assigned(Core. AcronymDb.Categories.SearchByName(S)) then begin;105 TAcronymCategory(Core. AcronymDb.Categories[Core.AcronymDb.Categories.Add(TAcronymCategory.Create)]).Name := S;106 Core. AcronymDb.Modified := True;107 Core. AcronymDb.Update;96 if not Assigned(Core.Core.AcronymDb.Categories.SearchByName(S)) then begin; 97 TAcronymCategory(Core.Core.AcronymDb.Categories[Core.Core.AcronymDb.Categories.Add(TAcronymCategory.Create)]).Name := S; 98 Core.Core.AcronymDb.Modified := True; 99 Core.Core.AcronymDb.Update; 108 100 UpdateList; 109 101 end else ShowMessage(Format(SCategoryAlreadyExists, [S])); … … 118 110 if ListViewCategories.Items[I].Selected then begin 119 111 TAcronymCategory(ListViewCategories.Items[I].Data).Enabled := False; 120 Core. AcronymDb.Modified := True;112 Core.Core.AcronymDb.Modified := True; 121 113 end; 122 114 UpdateList; … … 130 122 if ListViewCategories.Items[I].Selected then begin 131 123 TAcronymCategory(ListViewCategories.Items[I].Data).Enabled := True; 132 Core. AcronymDb.Modified := True;124 Core.Core.AcronymDb.Modified := True; 133 125 end; 134 126 UpdateList; … … 142 134 S := InputBox(SCategory, SCategoryQuery, ListViewCategories.Selected.Caption); 143 135 if S <> ListViewCategories.Selected.Caption then begin 144 if not Assigned(Core. AcronymDb.Categories.SearchByName(S)) then begin;136 if not Assigned(Core.Core.AcronymDb.Categories.SearchByName(S)) then begin; 145 137 TAcronymCategory(ListViewCategories.Selected.Data).Name := S; 146 Core. AcronymDb.Modified := True;147 Core. AcronymDb.Update;138 Core.Core.AcronymDb.Modified := True; 139 Core.Core.AcronymDb.Update; 148 140 UpdateList; 149 141 end else ShowMessage(Format(SCategoryAlreadyExists, [S])); … … 177 169 end; 178 170 179 procedure TFormCategories.FormClose(Sender: TObject;180 var CloseAction: TCloseAction);181 begin182 Core.PersistentForm1.Save(Self);183 end;184 185 171 procedure TFormCategories.FormCreate(Sender: TObject); 186 172 var 187 173 I: Integer; 188 174 begin 189 Core.Translator.TranslateComponentRecursive(Self);190 Core.ThemeManager.UseTheme(Self);191 175 for I := 0 to ToolBar1.ButtonCount - 1 do 192 176 ToolBar1.Buttons[I].Hint := ToolBar1.Buttons[I].Caption; … … 237 221 procedure TFormCategories.ListViewSort1Filter(ListViewSort: TListViewSort); 238 222 begin 239 Core. AcronymDb.Categories.AssignToList(ListViewSort1.List);223 Core.Core.AcronymDb.Categories.AssignToList(ListViewSort1.List); 240 224 end; 241 225 … … 243 227 begin 244 228 ListViewSort1.Refresh; 245 ListViewCategories.Items.Count := Core. AcronymDb.Categories.Count;229 ListViewCategories.Items.Count := Core.Core.AcronymDb.Categories.Count; 246 230 ListViewCategories.Refresh; 247 231 UpdateInterface;
Note:
See TracChangeset
for help on using the changeset viewer.