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
Solved

saving several settings

Posted on 2000-04-10
4
130 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

861 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