Changeset 228 for branches/xpascal/Packages/Common/FormEx.pas
- Timestamp:
- Jun 24, 2023, 12:33:35 PM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/xpascal/Packages/Common/FormEx.pas
r227 r228 11 11 12 12 TFormEx = class(TForm) 13 private 14 FCounter: Integer; static; 15 public 13 16 PersistentForm: TPersistentForm; static; 14 ThemeManager: TThemeManager; 15 Translator: TTranslator; 17 ThemeManager: TThemeManager; static; 18 Translator: TTranslator; static; 16 19 procedure DoShow; override; 17 20 procedure DoCreate; override; … … 27 30 procedure Register; 28 31 begin 29 Register Class(TFormEx);32 RegisterNoIcon([TFormEx]); 30 33 end; 31 34 … … 34 37 procedure TFormEx.DoShow; 35 38 begin 39 inherited; 36 40 PersistentForm.Load(Self); 37 inherited;38 41 end; 39 42 40 43 procedure TFormEx.DoCreate; 41 44 begin 42 inherited;43 45 if not Assigned(PersistentForm) then 44 46 PersistentForm := TPersistentForm.Create(nil); … … 52 54 Translator.TranslateComponentRecursive(Self); 53 55 ThemeManager.UseTheme(Self); 56 Inc(FCounter); 57 inherited; 54 58 end; 55 59 … … 62 66 procedure TFormEx.DoDestroy; 63 67 begin 64 FreeAndNil(PersistentForm); 65 FreeAndNil(ThemeManager); 66 FreeAndNil(Translator); 68 Dec(FCounter); 69 if FCounter <= 0 then begin 70 FreeAndNil(PersistentForm); 71 FreeAndNil(ThemeManager); 72 FreeAndNil(Translator); 73 end; 67 74 inherited; 68 75 end;
Note:
See TracChangeset
for help on using the changeset viewer.