troubleshooting Question

Ini file complication

Avatar of pr2501
pr2501 asked on
Delphi
11 Comments1 Solution619 ViewsLast Modified:
In the code below i have error :
[Pascal Error] openMap.pas(564): E2003 Undeclared identifier: 'WriteInteger'
for:
WriteInteger(Self.Name, cmpLabel.Name + ' Top', integer(TLabel(cmpLabel).Top));

You may see that am recording information abot  Tshape in first "try" section.
And if i work only with this section everything is ok. But when i add second "try" for Tlabel recording problems starts.

I believe i will have same problem for reading from ini file. But help me pleas at first   with storing.
       
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
  cmp,cmplabel: tcomponent;
  i,j: integer;
  Fname:string;
begin
  with TINIFile.Create(ExtractFilePath(Application.Exename) + 'yourini.ini')  do

  try
      
      i := 1;
      cmp := FindComponent('Shape' + IntToStr(i));
    while cmp <> nil do
    begin
       WriteInteger(Self.Name, cmp.Name + ' Brush Color', integer(TShape(cmp).Brush.Color));
;………………
    
       i := i + 1;
       cmp := FindComponent('Shape' + IntToStr(i));
       if cmp = nil then
         WriteInteger(Self.Name, 'Shapes', i-1);
       end;
   finally
    free;
    end;

  /////////77
  ///
   try
  j := 1;
    cmpLabel := FindComponent('Label' + IntToStr(j));
    while cmpLabel <> nil do
    begin
  //     WriteInteger(Self.Name, cmpLabel.Name + ' Height', integer(TLabel(cmpLabel).Height));
       WriteInteger(Self.Name, cmpLabel.Name + ' Top', integer(TLabel(cmpLabel).Top));
       WriteInteger(Self.Name, cmpLabel.Name + ' Left', integer(TLabel(cmpLabel).Left));

         j := j + 1;
       cmpLabel := FindComponent('Label' + IntToStr(j));
       if cmplabel = nil then
         WriteInteger(Self.Name, 'Label', j-1);
    end;
  ///  /////77
  IniFile.Free;
   finally
   free;
 end ;
end;
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 11 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros