I must provide a means for the User to choose their preferred font, and their preferred font colour. This preferance should be saved to disk in a file called ExtrasPreferances.ini in the root directory of my drive u: drive. When the application loads it should read the users saved preferances and apply them to all of the forms the application subsequently opens. Also since this functionality is likely to be extended in the future you should encapusulate all of this functionality in a class of your own devising which is accesses only from the main form.
Who is Participating?
Melih SARICAConnect With a Mentor OwnerCommented:
save them in their local hdd..


create a ini file part for each username
and create values for all preferences u want

      ..., IniFiles;

   ClassClientOptions = class
     Form1Color : TColor;
     procedure LoadFromFile(FileName : String);
     procedure SaveToFile (FileName : String);

   // example pof procedure LoadFromFile
   procedure ClassClientOptions.LoadFromFile(FileName : String);
      IniFile : TIniFile;
      IniFile := TIniFile.Create(FileName);
      with IniFile do
            Form1Color := IniFile.ReadInteger('Settings', 'FormColor', clBlue);
            // etc ... your code below

   use LoadFromFile in OnCreate and SaveFromFile in OnClose of the form

   define variabe with class ClassClientOptions only once and use it as global variable.
James_NapierAuthor Commented:
If i want to save each specific user how would i go about this.
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Melih SARICAOwnerCommented:
Make  Gloabal Variable

  Selected_font : String;
  Selected Color : string ;

On form Creation
   with tinifile.create('u:\') do
     Selected_font := readString('Prefered','fontname','');
     Selected Color:= readString('Prefered','fontColor','');

And u ll use all these to variables in all ur Forms...

James_NapierAuthor Commented:
Thanks thats a great help.
Melih SARICAOwnerCommented:
I think ... i musnt get the all point from this question ..
Ivanov's answer is worth to share .. I ll be pleased to share it with Ivanov..

cuz he points another opinion about this kinda  works..

Creating a  class.. and using it.. saving and loading preferences as a standart part of ur application..


   non_zero, you are friend ... :)))

   it is author decision who and how much points to give. don't bother with this. it is ok :)))
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.