[Lazarus] Multi-Device Designer

Martin Schreiber mse00000 at gmail.com
Wed Feb 25 16:36:36 CET 2015


On Wednesday 25 February 2015 14:02:33 Mattias Gaertner wrote:
> 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.
>
MSEi18n actually works with such an approach. It builds different 
resource-dll's/so's for different languages based on master form resource 
files (MSEgui counterpart of Lazarus *.lfm files) and a property table with a 
column for every language. The application loads the coresponding dll/so 
based on the language settings.
Several years ago MSEi18n already has been used to adapt the gui of an 
application for different display environments:
http://wiki.freepascal.org/MSEide_&_MSEgui#An_embedded_system

It is planned to extend MSEi18n with a form designer in order to edit the 
widget properties graphically.

Martin




More information about the Lazarus mailing list