Re: [Lazarus] Difference between Delphi 2010 / Lazarus

2012-12-14 Thread Kostas Michalopoulos
What does Calculated do?


On Thu, Dec 13, 2012 at 11:57 PM, Howard Page-Clark h...@talktalk.netwrote:

 On 13/12/12 9:45, Jorge Gonçalves wrote:

 Hi,
 I'm translating one application from delphi  to lazarus, and I'm having
 some problems with the way lazarus and delphi stores calculate fields in
 the dfm.
 The delphi store one more property :Calculated. This property is
 public and are stored using the procedure DefineProperties at TField
 level.

 dfm example :
 Delphi :
 object DetailsTOTAL: TFloatField
FieldKind = fkCalculated
FieldName = 'TOTAL'
DisplayFormat = '0.00'
 *   Calculated = True*

  end

 Lazarus :
 object DetailsTOTAL: TFloatField
FieldKind = fkCalculated
FieldName = 'TOTAL'
DisplayFormat = '0.00'
  end

 Any easy way to solve the problem ?


 Bit of a hack, but you could use the Tag property as a boolean on Lazarus.
 Its published, so is stored in the .lfm. But obviously this would require
 {$IFDEF  } to compile on Delphi too.


 --
 __**_
 Lazarus mailing list
 Lazarus@lists.lazarus.**freepascal.orgLazarus@lists.lazarus.freepascal.org
 http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarushttp://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Difference between Delphi 2010 / Lazarus

2012-12-14 Thread michael . vancanneyt



On Fri, 14 Dec 2012, Kostas Michalopoulos wrote:


What does Calculated do?


Judging from the Delphi code, it is no longer used. 
The GetCalculated returns


function TField.GetCalculated: Boolean;
begin
  Result := FFieldKind = fkCalculated;
end;

And setcalculated does:

procedure TField.SetCalculated(Value: Boolean);
begin
  if Value then
FieldKind := fkCalculated
  else if FieldKind = fkCalculated then
FieldKind := fkData;
end;

So it can safely be ignored.

Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Difference between Delphi 2010 / Lazarus

2012-12-14 Thread Jorge Gonçalves

 What does Calculated do?


 Judging from the Delphi code, it is no longer used. The GetCalculated
 returns


Yes i know.
The problem surges when we read the dfm. The reader will give one exception
that the property is unknown.
If we try to remove the property from the file, Delphi will introduce them
again, next time we edit the datamoudule.


jGoncalves
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Difference between Delphi 2010 / Lazarus

2012-12-14 Thread Mattias Gaertner
On Fri, 14 Dec 2012 10:05:52 +
Jorge Gonçalves projo...@gmail.com wrote:

 
  What does Calculated do?
 
 
  Judging from the Delphi code, it is no longer used. The GetCalculated
  returns
 
 
 Yes i know.
 The problem surges when we read the dfm. The reader will give one exception
 that the property is unknown.
 If we try to remove the property from the file, Delphi will introduce them
 again, next time we edit the datamoudule.

I added an ignore in lcl/dbctrls.pp:
  RegisterPropertyToSkip(TField,'Calculated','VCL compatibility property', '');

Please test.

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Difference between Delphi 2010 / Lazarus

2012-12-14 Thread michael . vancanneyt



On Fri, 14 Dec 2012, Jorge Gonçalves wrote:



What does Calculated do?




Judging from the Delphi code, it is no longer used. The GetCalculated
returns



Yes i know.
The problem surges when we read the dfm. The reader will give one exception
that the property is unknown.
If we try to remove the property from the file, Delphi will introduce them
again, next time we edit the datamoudule.


You can install an unknown property event handler in TReader: OnPropertyNotFound

But that requires that you are able to choose which reader is used, because
now you cannot: I've long wanted to install a hook so you can select which 
reader/writer is used in TStream.ReadComponent.


Maybe the lazarus implementation offers a hook ?

Michael.--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Difference between Delphi 2010 / Lazarus

2012-12-14 Thread Mattias Gaertner
On Fri, 14 Dec 2012 11:30:31 +0100 (CET)
michael.vancann...@wisa.be wrote:

 
 
 On Fri, 14 Dec 2012, Jorge Gonçalves wrote:
 
 
  What does Calculated do?
 
 
  Judging from the Delphi code, it is no longer used. The GetCalculated
  returns
 
 
  Yes i know.
  The problem surges when we read the dfm. The reader will give one exception
  that the property is unknown.
  If we try to remove the property from the file, Delphi will introduce them
  again, next time we edit the datamoudule.
 
 You can install an unknown property event handler in TReader: 
 OnPropertyNotFound
 
 But that requires that you are able to choose which reader is used, because
 now you cannot: I've long wanted to install a hook so you can select which 
 reader/writer is used in TStream.ReadComponent.
 
 Maybe the lazarus implementation offers a hook ?

Maybe you mean in unit lresources.pp:
  LRSObjectReaderClass: TLRSObjectReaderClass=TLRSObjectReader;
  LRSObjectWriterClass: TLRSObjectWriterClass=TLRSObjectWriter;

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Difference between Delphi 2010 / Lazarus

2012-12-14 Thread michael . vancanneyt



On Fri, 14 Dec 2012, Mattias Gaertner wrote:


On Fri, 14 Dec 2012 11:30:31 +0100 (CET)
michael.vancann...@wisa.be wrote:




On Fri, 14 Dec 2012, Jorge Gonçalves wrote:


 What does Calculated do?


 Judging from the Delphi code, it is no longer used. The GetCalculated
 returns


 Yes i know.
 The problem surges when we read the dfm. The reader will give one exception
 that the property is unknown.
 If we try to remove the property from the file, Delphi will introduce them
 again, next time we edit the datamoudule.

You can install an unknown property event handler in TReader: OnPropertyNotFound

But that requires that you are able to choose which reader is used, because
now you cannot: I've long wanted to install a hook so you can select which 
reader/writer is used in TStream.ReadComponent.


Maybe the lazarus implementation offers a hook ?


Maybe you mean in unit lresources.pp:
 LRSObjectReaderClass: TLRSObjectReaderClass=TLRSObjectReader;
 LRSObjectWriterClass: TLRSObjectWriterClass=TLRSObjectWriter;


Something like it, and also the hooks you posted in your other reply.

I think that the 2 variables you post above can be moved to the classes
unit: ObjectReaderClass and ObjectWriterClass. These should then be used in
the TStream.ReadComponent and TStream.WriteComponent.

That's what I meant with the 'install a hook'.

Once it is in place, the LCL can simply set these hooks, and remove any
custom hooks you made.

Michael.--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Difference between Delphi 2010 / Lazarus

2012-12-14 Thread Jorge Gonçalves
Worked 
for now I'm  using on my own unit as a temporary hack.

Thx
jGoncalves


On Fri, Dec 14, 2012 at 10:21 AM, Mattias Gaertner 
nc-gaert...@netcologne.de wrote:

 On Fri, 14 Dec 2012 10:05:52 +
 Jorge Gonçalves projo...@gmail.com wrote:

  
   What does Calculated do?
  
  
   Judging from the Delphi code, it is no longer used. The GetCalculated
   returns
  
  
  Yes i know.
  The problem surges when we read the dfm. The reader will give one
 exception
  that the property is unknown.
  If we try to remove the property from the file, Delphi will introduce
 them
  again, next time we edit the datamoudule.

 I added an ignore in lcl/dbctrls.pp:
   RegisterPropertyToSkip(TField,'Calculated','VCL compatibility property',
 '');

 Please test.

 Mattias

 --
 ___
 Lazarus mailing list
 Lazarus@lists.lazarus.freepascal.org
 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Difference between Delphi 2010 / Lazarus

2012-12-13 Thread Jorge Gonçalves
Hi,
I'm translating one application from delphi  to lazarus, and I'm having
some problems with the way lazarus and delphi stores calculate fields in
the dfm.
The delphi store one more property :Calculated. This property is public
and are stored using the procedure DefineProperties at TField level.

dfm example :
Delphi :
   object DetailsTOTAL: TFloatField
  FieldKind = fkCalculated
  FieldName = 'TOTAL'
  DisplayFormat = '0.00'
   *   Calculated = True*
end

Lazarus :
   object DetailsTOTAL: TFloatField
  FieldKind = fkCalculated
  FieldName = 'TOTAL'
  DisplayFormat = '0.00'
end

Any easy way to solve the problem ?

ps :
 The application must compile on both compilers.
 Lazarus version 1.1 with FPC 2.6.1. SVN Revision : 39433

Thx
jGoncalves
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Difference between Delphi 2010 / Lazarus

2012-12-13 Thread Howard Page-Clark

On 13/12/12 9:45, Jorge Gonçalves wrote:

Hi,
I'm translating one application from delphi  to lazarus, and I'm having
some problems with the way lazarus and delphi stores calculate fields in
the dfm.
The delphi store one more property :Calculated. This property is
public and are stored using the procedure DefineProperties at TField level.

dfm example :
Delphi :
object DetailsTOTAL: TFloatField
   FieldKind = fkCalculated
   FieldName = 'TOTAL'
   DisplayFormat = '0.00'
*   Calculated = True*
 end

Lazarus :
object DetailsTOTAL: TFloatField
   FieldKind = fkCalculated
   FieldName = 'TOTAL'
   DisplayFormat = '0.00'
 end

Any easy way to solve the problem ?


Bit of a hack, but you could use the Tag property as a boolean on 
Lazarus. Its published, so is stored in the .lfm. But obviously this 
would require {$IFDEF  } to compile on Delphi too.



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus