Link to home
Start Free TrialLog in
Avatar of Diggie
Diggie

asked on

saving several settings

(sorry if this has been asked before..)
I want to save several usersettings to registry. I've created a form with edtiboxes on a pagecontrol and a function to save a setting to the registry. This works fine, but I want to automate the function so that it scrolls trough the pages and save every editbox text property in the Reg. using the editbox name property. (This seems an easy way to store mult. settings; any suggestion is welcome!)
Avatar of Epsylon
Epsylon

You can do something like this

  for i := 0 to ComponentCount - 1 do
    if (Components[i].Parent = Pagecontrol1) and (Components[i] is TEdit) then
      with (Components[i] as TEdit) do
        ToRegistry(Name, Text);


Not sure if this is what you're looking for...
ASKER CERTIFIED SOLUTION
Avatar of Epsylon
Epsylon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Diggie,

Have a look at this article/component from Delphi Informant magazine.

http://www.delphizine.com/features/1997/10/di199710rv_f/di199710rv_d.asp

it can save virtually any aspect of a form to the registry

Mark
Avatar of Diggie

ASKER

Damn! (Sorry for my language!)
This was my own solution for the problem (although I didn't work out the complete code...). I just wondered if this is the way professional programmers store their settings, or that I was barking at the wrong tree...
Anyway, thank you for your reply (and for showing me i'm not an idiot)