Solved

saving several settings

Posted on 2000-04-10
4
126 Views
Last Modified: 2010-04-04
(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!)
0
Comment
Question by:Diggie
  • 2
4 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 2702100
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...
0
 
LVL 13

Accepted Solution

by:
Epsylon earned 100 total points
ID: 2702153
This is a more worked-out solution:

var p, c: Integer;
begin
  for p := 0 to PageControl1.PageCount - 1 do
    for c := 0 to PageControl1.Pages[p].ControlCount - 1 do
      if PageControl1.Pages[p].Controls[c] is TEdit then
        with PageControl1.Pages[p].Controls[c] as TEdit do
          ToRegistry(Name, Text);
end;


Regards,

Epsylon.
0
 
LVL 2

Expert Comment

by:mullet_attack
ID: 2702175
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
0
 
LVL 3

Author Comment

by:Diggie
ID: 2702253
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)
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This video discusses moving either the default database or any database to a new volume.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now