Sign in Join

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

Mailing lists / lazarus / 2012-12

Difference between Delphi 2010 / Lazarus

10 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

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

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20121213/3e2a0790/attachment.html>

Reply by email

Howard Page-Clark
to Jorge Gonçalves
Jorge Gon?alves wrote 24 lines
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.

Reply by email

Kostas Michalopoulos
to Howard Page-Clark

What does "Calculated" do?

Howard Page-Clark wrote 41 lines
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 .**freepascal.org http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20121214/ac584928/attachment.html>

Reply by email

Unknown author
to Kostas Michalopoulos
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.

Reply by email

Jorge Gonçalves
to Unknown author
Show quoted text 8 lines
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20121214/45c284f2/attachment.html>

Reply by email

Mattias Gaertner
to Jorge Gonçalves
Show quoted text 13 lines
> > 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

Reply by email

Unknown author
to Jorge Gonçalves: Yes i know. The problem surges when we read the dfm. The reader will give one exception…
Jorge Gon?alves wrote 13 lines
> > 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.

Reply by email

Mattias Gaertner
to Unknown author
Show quoted text 25 lines
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

Reply by email

Unknown author
to Mattias Gaertner
Mattias Gaertner wrote 32 lines
On Fri, 14 Dec 2012 11:30:31 +0100 (CET) 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.

Reply by email

Jorge Gonçalves
to Mattias Gaertner: On Fri, 14 Dec 2012 10:05:52 +0000 I added an ignore in lcl/dbctrls.pp:…

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 <

Show quoted text 35 lines
wrote: On Fri, 14 Dec 2012 10:05:52 +0000 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. I added an ignore in lcl/dbctrls.pp: RegisterPropertyToSkip(TField,'Calculated','VCL compatibility property', ''); Please test. Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20121214/29d3a0dd/attachment.html>

Reply by email