[Lazarus] Multi-Device Designer

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Feb 25 14:02:33 CET 2015


On Wed, 25 Feb 2015 10:39:12 +0000
Graeme Geldenhuys <mailinglists at geldenhuys.co.uk> wrote:

> On 2015-02-25 09:31, Mattias Gaertner wrote:
> > Of course you can use VFI to create custom views - for
> > different platforms, devices, releases or whatever
> > flavors.
> 
> But the difference between Delphi and Lazarus would be how you reference
> those forms. In Delphi FMX (as far as I understand) you would simply
> reference your form as SomeForm - regardless of the target device. FMX
> would resolve that automatically to the correct device specific
> implementation if one exists.

I guess, but I only saw the promotion video, so maybe it is not that
simple.

If someone wants the same in Lazarus:

For example the {$R *.iPhone4in.fmx IOS} directive can be replaced with
{$ifdef iphonesim}{$R *.iphone4in.lfm}{$endif}

The LCL (or msegui or whatever GUI lib) needs to be extended to search
and load the second lfm resource. That needs only a few lines of code.

And finally the IDE needs to be extended to load/update the secondary
lfm.

 
> Whereas in Lazarus LCL's VFI you would have different units and
> different form names for each target. So you would have to wrap all
> those in IFDEF's. Is this correct?

Well, you could do it without IFDEFs, but then all resources are
compiled into the binary. Or you can load the lfm files via another
mechanism.
When programming multi platform the question is not *if* you need
IFDEFs, but how many.

 
Mattias




More information about the Lazarus mailing list