RAD Studio 10.4.1 is now available! Learn more. Looking for discounts? Visit our Special Offers page!
News

Skill Sprint: Saving and Retrieving Settings Using SaveState

Author: Developer Skill Sprints

Introduction to “SaveState”

  • Persist form & app state between sessions
  • On mobile devices, background apps may be terminated for memory
  • Default saves state to transient / temporary storage
  • Also option to save to persistent storage

TFormSaveState

  • FireMonkey TForm and TForm3D
    • SaveState: TFormSaveState property
    • OnSaveState: TNotifyEvent event
  • TFormSaveState.Stream: TMemoryStream
    • Stream to load and save state from
  • TFormSaveState.StoragePath: String
    • Location persisted too (default is temporary path)
  • TFormSaveState.Name: String
    • Customize persistence file name (allows for multiple files)

Platform Behaviors for SaveState 

  • Android
    • Transient is stored in the native activity
    • Transient state lost if app terminated manually
    • Test with “Developer Options” → “Don’t keep activities”
  • iOS, Windows, OS X
    • Still persisted when app manually terminated
  • Windows & OS X
    • Default location is shared temp folder

More information

Samples

Replays

Delphi Skill Sprint




Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Deep Dive Webinar: Boost C++Builder Compile Speed with TwineCompile
Related posts
C++

What's New in the GetIt Package Manager - June 2020

C++

RAD Studio 10.4 Now Available, Learn More

C++NewsRAD Studio

Open for Business with 10.4! - May 2020 GM Update

C++DelphiNews

Embarcadero Open Source Project Sponsorship

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES