Recent

Author Topic: TMemo remember font settings.  (Read 290 times)

Zath

  • Sr. Member
  • ****
  • Posts: 369
TMemo remember font settings.
« on: April 10, 2021, 04:56:24 pm »
TMemo remember font settings.

What's the preferred way to store/remember use selected font settings please ?

My Memo is set to System font by default for the fixed width aspect but many will obviously change it.

Thanks

wp

  • Hero Member
  • *****
  • Posts: 8579
Re: TMemo remember font settings.
« Reply #1 on: April 10, 2021, 05:40:31 pm »
I usually put all these user settings into an ini file which is written when the application ends and read back when it starts the next time.

In a similar question posted recently I played with the TXMLPropStorage, and this is very handy and you can store the font settings without writing a single line of code:
  • Put a TXMLStorage (or TIniStorage or TJsonStorage) component on the form (they are on palette "Misc")
  • Open the SessionProperties of the form by clicking the '...' button in the OI, select the Memo in the component list and its Font in the properties list. Then click Add.
  • That's all!
(Of course you can add other properties to the SessionProperties to be stored by the XMLStorage component.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Zath

  • Sr. Member
  • ****
  • Posts: 369
Re: TMemo remember font settings.
« Reply #2 on: April 10, 2021, 06:07:37 pm »
Excellent, thanks.

 

TinyPortal © 2005-2018