Jump to content
FreeDelphiPascal

Autosave the state of the GUI to disk on app shutdown with one function call

Recommended Posts

I published recently my Delphi libraries. It features all kinds of goodies, among them:

 

* Saving the state of the GUI at application shutdown and then restoring it at application start-up.

  • Just call SaveForm() and LoadForm(). That's it.

 

* An extension for the TApplication class

  •   ResurectInstance(CONST CommandLine: string);
  •   InstanceRunning: Boolean;
  •   SetSingleInstanceName(var Params: TCreateParams);
  •  
  •   Initializing: Boolean;                           { Set it to false once your app finished initializing (usually after you finished creating all forms). Used in cvIniFile.pas. }
  •   CurFolder: string; //Old name: AppDir
  •   SysDir: string;
  •   IniFile: string;
  •  
  •   AppName: string  read FAppName;
  •   AppDataFolder(ForceDir: Boolean= FALSE): string;
  •   AppDataFolderAllUsers: string;
  •   AppShortName: string;
  •  
  •   LastUsedFolder: string read getLastUsedFolder write FLastFolder;
  •   RunningFirstTime: Boolean read FRunningFirstTime;        { Returns true if the application is running for the first time in this computer }
  •  
  •   Restore;
  •   Restart;
  •   SelfDelete;
  •   RunSelfAtWinStartUp(Active: Boolean): Boolean;
  •   RunFileAtWinStartUp(FilePath: string; Active: Boolean): Boolean;
  •  
  •   SetMaxPriority;
  •   HideFromTaskbar;
  •   GetVersionInfo(ShowBuildNo: Boolean= False): string;
  •  
  •   RunningHome: Boolean;
  •   BetaTesterMode: Boolean;

 

* Lots of string processing and IO utilities.

 

* Many other goodies (a total of 164 pas files).


In the last update, I added another sublibrary (graphic utilities) and support for self-translating forms. This is an RTTI-based automatic translation engine for Delphi.

It will translate all GUI strings (for example TLabel.Caption, TLabel.Hint, TMenuItem.Caption) for all live forms in your application.
The text is stored in an INI file which can be sent to DeepL or GoogleTranslate for translation (this last part has yet to be implemented) - but it will come soon.

You only need to call one procedure in order to have your app translated into multiple languages (until the Google Translate module is implemented you have to provide of course the translation files).

 

All modules up to (and including) Graphics are available.

The rest will come as I have time.

image.thumb.png.d56489caf320a46a6c41b292b207e4c3.png

 

The whole library is free on GitHub.

Waiting for feedback.


Enjoy.

Edited by FreeDelphiPascal

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×