Sign in Join

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

Mailing lists / lazarus / 2002-07

old delphi conversion & lrs

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

John August

I'm converting an old Delphi program to lazarus, but have trouble with the resources.

There's a file bcddisp2.dfm which I've converted to bcddisp2.lrs. I'm concerned about the .PAS rather than .pp files referred to, but that's not the problem.

There are never any references to bcddisp2.lrs when I do an strace during the compilation or execution. During compilation, a 'stat' is done once on this file, regardless of the presence or absence of the {$I ... } modifier.

A code section follows :

initialization
{$I bcddisp2.lrs}
writeln ('in initialise code');

And I do get the 'in initialise code' being displayed. But the lrs file does not enter the picture, even to cause a bug.

Are there additional settings to enable this, or something.

I'm using fpc 1.0.6 and I'm pretty sure a Lazarus recent to within a few days CVS update.

Thanks for any help,

John August

Reply by email

Mattias Gaertner
to John August
There are never any references to bcddisp2.lrs when I do an strace during the compilation or execution. During compilation, a 'stat' is done once on this file, regardless of the presence or absence of the {$I ... } modifier.

Hmm, I got a read and a stat.

Show quoted text 8 lines
A code section follows : initialization {$I bcddisp2.lrs} writeln ('in initialise code'); And I do get the 'in initialise code' being displayed. But the lrs file does not enter the picture, even to cause a bug.

You lrs file _is_ included, or else the compiler would abort with missing include file. Can you give more details?
Why do you believe, the lrs file is not included?

Are there additional settings to enable this, or something.

No.

Mattias

Reply by email

Mattias Gaertner
to John August: I'm converting an old Delphi program to lazarus, but have trouble with the resources.…
Show quoted text 5 lines
I'm still having problems, in that the structures set up by the lrs file are not happening. Regardless of whether the { $I ...} statement is there or not, all that happens is that the default Form1, unlabelled, is set up, without any of the underlying structure. There's no caption, you cannot click and get anything to happen.

The simplest reason is that the wrong resource is looked up. But I guess you have already checked for the form name and classname ...

Is there a way of finding out just what the .lrs file has setup ?

Add some writelns to the form constructor. For example:

constructor TForm1.Create(TheOwner: TComponent);
var i: integer;
begin
  inherited Create(TheOwner);
  writeln('ComponentCount=',ComponentCount);
  for i:=0 to ComponentCount-1 do begin
    writeln('i=',i,' Name=',Components[i].Name,':',Components[i].ClassName);
  end;
end;
Two (possibly related) questions : - If the files are named differently (case, using .PAS rather than .pp) in the .lrs file, will this cause problems ? Would it be detected ?

Just look into the .lrs file, it is simple pascal code. The Lazarus resources are case insensitive.

- Can you have a panel within the root (TForm1 / Form1) Form ? I have problems getting this to work, and I know the application wants to set this up.

Just checked. TPanel on a Form works.

Maybe this will help:
- check if the line in the .lrs corresponds to your form. For example, if you declared the form variable: var Form1: TForm1;
then the .lrs file should contain a statement:
LazarusResources.Add('TForm1','FORMDATA', ... );

Mattias

Reply by email

John August
to John August: I'm converting an old Delphi program to lazarus, but have trouble with the resources.…
Mattias Gaertner wrote 9 lines
On Sun, 14 Jul 2002 12:05:41 +1000 John August wrote: > There are never any references to bcddisp2.lrs when I do an strace during > the compilation or execution. During compilation, a 'stat' is done once > on this file, regardless of the presence or absence of the {$I ... } > modifier. Hmm, I got a read and a stat.

OK, yes, you do get a read and a stat. I had extraneous .ppu and .o files lying around.

You lrs file _is_ included, or else the compiler would abort with missing include file. Can you give more details? Why do you believe, the lrs file is not included?

I'm still having problems, in that the structures set up by the lrs file are not happening. Regardless of whether the { $I ...} statement is there or not, all that happens is that the default Form1, unlabelled, is set up, without any of the underlying structure. There's no caption, you cannot click and get anything to happen.

Is there a way of finding out just what the .lrs file has setup ?

Two (possibly related) questions :

- If the files are named differently (case, using .PAS rather than .pp) in the .lrs file, will this cause problems ? Would it be detected ?

- Can you have a panel within the root (TForm1 / Form1) Form ? I have problems getting this to work, and I know the application wants to set this up.

Thanks,

John August

Reply by email