Posted on 2004-04-27
Medium Priority
Last Modified: 2010-04-05
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.
Question by:James_Napier
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
LVL 12

Expert Comment

ID: 10928628

      ..., 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.

Author Comment

ID: 10928673
If i want to save each specific user how would i go about this.
LVL 19

Expert Comment

by:Melih SARICA
ID: 10928680
Make  Gloabal Variable

  Selected_font : String;
  Selected Color : string ;

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

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 19

Accepted Solution

Melih SARICA earned 1500 total points
ID: 10928694
save them in their local hdd..


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

Author Comment

ID: 10928743
Thanks thats a great help.
LVL 19

Expert Comment

by:Melih SARICA
ID: 10928749
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..

LVL 12

Expert Comment

ID: 10928802

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

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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month10 days, 22 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question