Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-03

How to use data from stringlist in another form.

6 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

appjaws

I have 2 forms, form 1 calls form 2 on a buttonclick process. Form 2 loads a string list, operations are carried out and the stringlist is saved.

The application opens with form 1, data is produced and stored in a Tedit

What I want to do is to compare the Tedit on form1 with data held in the stringlist of form2. The problem is that the stringlist is not yet created from the stringlist file.
I have tried to load the stringlist from within form 1 but compilation fails with :-
TestProj1.lpr(21,1) Error: Error while compiling resources. Compile with -vd for more details. Check for duplicates.

The messaged produced using -vd did not indicate any duplicates and terminated the application with the same message.

I'm sure this must be possible but with my limited knowledge, I can't see how.

Thanks for any help
Paul

---This message has been sent using Thunderbird on kubuntu---

Reply by email

Mattias Gaertner
to appjaws
Show quoted text 19 lines
I have 2 forms, form 1 calls form 2 on a buttonclick process. Form 2 loads a string list, operations are carried out and the stringlist is saved. The application opens with form 1, data is produced and stored in a Tedit What I want to do is to compare the Tedit on form1 with data held in the stringlist of form2. The problem is that the stringlist is not yet created from the stringlist file. I have tried to load the stringlist from within form 1 but compilation fails with :- TestProj1.lpr(21,1) Error: Error while compiling resources. Compile with -vd for more details. Check for duplicates. The messaged produced using -vd did not indicate any duplicates and terminated the application with the same message. I'm sure this must be possible but with my limited knowledge, I can't see how.

The "Error while compiling resources" has nothing to do with stringlists or any runtime logic.

What fpc version?
What platform?

Mattias

Reply by email

appjaws
to Mattias Gaertner
Mattias Gaertner wrote 32 lines
On Tue, 26 Mar 2013 14:14:00 +0000 appjaws wrote: > I have 2 forms, form 1 calls form 2 on a buttonclick process. > Form 2 loads a string list, operations are carried out and the > stringlist is saved. > > The application opens with form 1, data is produced and stored in a Tedit > > What I want to do is to compare the Tedit on form1 with data held in the > stringlist of form2. The problem is that the stringlist is not yet > created from the stringlist file. > I have tried to load the stringlist from within form 1 but compilation > fails with :- > TestProj1.lpr(21,1) Error: Error while compiling resources. Compile with > -vd for more details. Check for duplicates. > > The messaged produced using -vd did not indicate any duplicates and > terminated the application with the same message. > > I'm sure this must be possible but with my limited knowledge, I can't > see how. The "Error while compiling resources" has nothing to do with stringlists or any runtime logic. What fpc version? What platform? Mattias --

fpc 2.6.2, Lazarus 1.0.8 running on kubuntu linux

I copied the stringlist code from form 2 to form 1 and had the errors, so I thought that reusing the code was the wrong thing to do, once I removed it the app compiled without error.
So I need to know if and how to do this.
Thanks
Paul

---This message has been sent using Thunderbird on kubuntu---

Reply by email

Avishai
to appjaws: I have 2 forms, form 1 calls form 2 on a buttonclick process. Form 2 loads a string list,…

I'm not able to check right now but if memory serves me right... In Form1 you can call Form2.StringList[x]

appjaws wrote 31 lines
I have 2 forms, form 1 calls form 2 on a buttonclick process. Form 2 loads a string list, operations are carried out and the stringlist is saved. The application opens with form 1, data is produced and stored in a Tedit What I want to do is to compare the Tedit on form1 with data held in the stringlist of form2. The problem is that the stringlist is not yet created from the stringlist file. I have tried to load the stringlist from within form 1 but compilation fails with :- TestProj1.lpr(21,1) Error: Error while compiling resources. Compile with -vd for more details. Check for duplicates. The messaged produced using -vd did not indicate any duplicates and terminated the application with the same message. I'm sure this must be possible but with my limited knowledge, I can't see how. Thanks for any help Paul -- ---This message has been sent using Thunderbird on kubuntu--- -- ______________________________**_________________ Lazarus mailing list .**freepascal.org http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>
Shalom, Avishai ????? ???? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130326/ebe5b18f/attachment.html>

Reply by email

Antonio Fortuny
to appjaws: I have 2 forms, form 1 calls form 2 on a buttonclick process. Form 2 loads a string list,…

Le 26/03/2013 15:14, appjaws a ?crit :

I have 2 forms, form 1 calls form 2 on a buttonclick process. Form 2 loads a string list, operations are carried out and the stringlist is saved.

on FormMain:
...
implementation
uses

   unit2;
procedure TFrmMain.Button1Click(Sender: TObject);
begin
   if Form1.List.Count = 0 then
     Form1.LoadList;
   // do whatever do to to compare
end;
==============================================
on second form:
unit unit2;
{$mode objfpc}{$H+}
interface
uses
   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs;
type
   { TForm1 }
   TForm1 = class(TForm)
     procedure FormCreate(Sender: TObject);
     procedure FormDestroy(Sender: TObject);
   private
     { private declarations }
     FList: TStringList;
   public
     { public declarations }
     procedure LoadList;
     property List: TStringList read FList;
   end;
var
   Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
   FList := TStringList.Create;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
   FList.Free
end;
procedure TForm1.LoadList;
begin
   FList.LoadFromFile('myfile.txt')
end;
end.

All this compiles and runs.
Do not forget to create Form1 before it is used in MainForm

Antonio.

Reply by email

appjaws
to Antonio Fortuny
Antonio Fortuny wrote 60 lines
Le 26/03/2013 15:14, appjaws a ?crit : > I have 2 forms, form 1 calls form 2 on a buttonclick process. > Form 2 loads a string list, operations are carried out and the > stringlist is saved. on FormMain: ... implementation uses unit2; procedure TFrmMain.Button1Click(Sender: TObject); begin if Form1.List.Count = 0 then Form1.LoadList; // do whatever do to to compare end; ============================================== on second form: unit unit2; {$mode objfpc}{$H+} interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs; type { TForm1 } TForm1 = class(TForm) procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); private { private declarations } FList: TStringList; public { public declarations } procedure LoadList; property List: TStringList read FList; end; var Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.FormCreate(Sender: TObject); begin FList := TStringList.Create; end; procedure TForm1.FormDestroy(Sender: TObject); begin FList.Free end; procedure TForm1.LoadList; begin FList.LoadFromFile('myfile.txt') end; end.

Thank you Antonio,
works well with no errors.
Paul

---This message has been sent using Thunderbird on kubuntu---

Reply by email