Introducing TMS FNC AppTools
What is TMS FNC AppTools?
What is included?
Let’s take a look at what is included in this first release!
TTMSFNCAppUpdate
Manage automatic internet based application updates. You can use HTTPS based locations for secure downloads. Username and password protected downloads are also supported!
The entry point to the automatic update is an .INF control file. By calling TTMSFNCAppUpdate.NewVersionAvailable the component will download and look at the contents of the control file. A single control file can be used to handle the updates for 3 supported platforms at the same time. This is achieved by a platform suffix (= win, macos or linux):
[update_platform] keywords [files_platform] count=N [file1_platform] keywords … [fileN_platform] keywords
The TTMSFNCAppUpdate component will automatically scan the control file for the platform it is running on, which means the platform specific suffix is always needed.
TTMSFNCAppUpdate gives huge flexibility after the control file has been read. When NewVersionAvailable is called, the FileList collection property will be filled with the contents of the control file. This allows you to freely remove or modify the file descriptors before continuing with the update.
procedure TForm1.Button1Click(Sender: TObject); begin if TMSFNCAppUpdate1.NewVersionAvailable then begin if TMSFNCAppUpdate1.FileList.Count > 0 then TMSFNCAppUpdate1.FileList[0].URL := 'newdownloadurl'; TMSFNCAppUpdate1.StartUpdate; end; end;
This becomes a lot simpler if you don’t need to change the file descriptors afterwards. Just call DoUpdate which will internally use NewVersionAvailable and StartUpdate and run the whole process at once.
TTMSFNCAppUpdate also supports predefined and custom prefixes that will be replaced in the path related keywords. For example: {APP} stands for the application folder. For custom prefixes you can implement the OnCustomPrefix event!
Curious to see it in action? Check our first video we prepared:
TTMSFNCAppFormPersist
With this component you can automatically persist and restore your application windows’ position, this way the application will open all its windows where you left them.
It’s also possible to save and load the position programmatically:
procedure TForm1.restoreBtnClick(Sender: TObject); var afp: TTMSFNCAppFormPersist; begin afp := TTMSFNCAppFormPersist.Create(Self); afp.FileName := './temp_settings.ini'; afp.LoadFormSettings; afp.Free; end; procedure TForm1.saveBtnClick(Sender: TObject); var afp: TTMSFNCAppFormPersist; begin afp := TTMSFNCAppFormPersist.Create(Self); afp.FileName := './temp_settings.ini'; afp.SaveFormSettings; afp.Free; end;
TTMSFNCAppLock
Keep your current workflow and sensitive data hidden by password locking your running application when needed or if it has been idling for a while. After locking all application windows become minimized and hidden.
To unlock, click the minimized application icon and use the default unlock dialog. Alternatively a custom unlocking mechanism can be used by implementing the OnQueryUnlock event. It’s also possible to unlock the application automatically by calling the Unlock method.
procedure TForm1.Button1Click(Sender: TObject); begin //Unlock automatically after 30 seconds Timer1.Interval := 30000; Timer1.Enabled := True; TMSFNCAppLock1.Lock; end; procedure TForm1.Timer1Timer(Sender: TObject); begin Timer1.Enabled := False; TMSFNCAppLock1.Unlock; end;
A new form of documentation
Did you know? To navigate to the component documentation right away, you can use the design-time context menu and choose the “Documentation” menu item!
Availability
What’s next?
This was just the first chapter in a new book. Share your ideas what would you like to see as a universal cross-platform component for desktop oriented development!