Sign in Join

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

Mailing lists / lazarus / 2014-04

lfm file format

13 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

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

Marc Santhoff

Hi,

ist there a complete documentation of Lazarus' LFM xml file format?

Maybe someone having good knowledge of the IDE source code can name the unit(s) where writing and reading forms is handled?

TIA,
Marc

Marc Santhoff

Reply by email

Mattias Gaertner
to Marc Santhoff
Hi, ist there a complete documentation of Lazarus' LFM xml file format?

No.
If someone wants to start one I will help.
Note: The xml format has not yet implemented all features.

Maybe someone having good knowledge of the IDE source code can name the unit(s) where writing and reading forms is handled?

xml "driver" reader/writer:
components/lazutils/laz_xmlstreaming.pas

Component streaming in general:
unit classes, see TReader/TWriter

IDE additions:
designer/jitforms.pp

Mattias

Reply by email

Marc Santhoff
to Mattias Gaertner
Mattias Gaertner wrote 10 lines
On Sat, 05 Apr 2014 12:06:20 +0200 Marc Santhoff wrote: > Hi, > > ist there a complete documentation of Lazarus' LFM xml file format? No. If someone wants to start one I will help. Note: The xml format has not yet implemented all features.

Oops, I confused something. I silently assumed .lfm's are stored in XML, but they are not. In fact the storage format is someting like XML without tags but python-like syntactical indentation.

Now I'm confused. When and how is XML used to store form descriptions? What use cases is it made for?

What I really want to do is to write some form descriptions (and code) by a generator program. If there is any existing code that can be reused it would be very helpful.

Show quoted text 11 lines
> Maybe someone having good knowledge of the IDE source code can name the > unit(s) where writing and reading forms is handled? xml "driver" reader/writer: components/lazutils/laz_xmlstreaming.pas Component streaming in general: unit classes, see TReader/TWriter IDE additions: designer/jitforms.pp

So for not generating form code myself I would learn to use jitforms unit. Do you see any problems in writing the code to a file instead of using it like in lazarus' desing mode?

Marc Santhoff

Reply by email

Mattias Gaertner
to Marc Santhoff
Show quoted text 15 lines
On Sa, 2014-04-05 at 12:23 +0200, Mattias Gaertner wrote: > On Sat, 05 Apr 2014 12:06:20 +0200 > Marc Santhoff wrote: > > > Hi, > > > > ist there a complete documentation of Lazarus' LFM xml file format? > > No. > If someone wants to start one I will help. > Note: The xml format has not yet implemented all features. Oops, I confused something. I silently assumed .lfm's are stored in XML, but they are not. In fact the storage format is someting like XML without tags but python-like syntactical indentation.

Yes.

Now I'm confused. When and how is XML used to store form descriptions?

Some people use it. The IDE does not.

What use cases is it made for?

Some people prefer xml.

What I really want to do is to write some form descriptions (and code) by a generator program. If there is any existing code that can be reused it would be very helpful.

This is too vague. What do you want to achieve?

Show quoted text 15 lines
> > Maybe someone having good knowledge of the IDE source code can name the > > unit(s) where writing and reading forms is handled? > > xml "driver" reader/writer: > components/lazutils/laz_xmlstreaming.pas > > Component streaming in general: > unit classes, see TReader/TWriter > > IDE additions: > designer/jitforms.pp So for not generating form code myself I would learn to use jitforms unit. Do you see any problems in writing the code to a file instead of using it like in lazarus' desing mode?

The jitforms unit is only useful if you want to write a form designer, which can load arbitrary forms with unknown classes. Normal loading/saving only needs the stuff of the RTL+LCL.

Mattias

Reply by email

Marc Santhoff
to Mattias Gaertner
Mattias Gaertner wrote 25 lines
On Sun, 06 Apr 2014 00:49:45 +0200 Marc Santhoff wrote: > On Sa, 2014-04-05 at 12:23 +0200, Mattias Gaertner wrote: > > On Sat, 05 Apr 2014 12:06:20 +0200 > > Marc Santhoff wrote: > > > > > Hi, > > > > > > ist there a complete documentation of Lazarus' LFM xml file format? > > > > No. > > If someone wants to start one I will help. > > Note: The xml format has not yet implemented all features. > > Oops, I confused something. I silently assumed .lfm's are stored in XML, > but they are not. In fact the storage format is someting like XML > without tags but python-like syntactical indentation. Yes. > Now I'm confused. When and how is XML used to store form descriptions? Some people use it. The IDE does not.

I see.

Show quoted text 10 lines
> What use cases is it made for? Some people prefer xml. > What I really want to do is to write some form descriptions (and code) > by a generator program. If there is any existing code that can be reused > it would be very helpful. This is too vague. What do you want to achieve?

I'm thinking about a programm that:
- opens a database
- generates form and source for each table
- uses mapping db-type -> gui component
- uses configuration

If you ever used the "Database Form Wizard/Assistant" of Openoffice you know what I want. Not exctly that way, but in result a basic form that can be trimmed to fit by hand afterwards.

Show quoted text 19 lines
> > > Maybe someone having good knowledge of the IDE source code can name the > > > unit(s) where writing and reading forms is handled? > > > > xml "driver" reader/writer: > > components/lazutils/laz_xmlstreaming.pas > > > > Component streaming in general: > > unit classes, see TReader/TWriter > > > > IDE additions: > > designer/jitforms.pp > > So for not generating form code myself I would learn to use jitforms > unit. Do you see any problems in writing the code to a file instead of > using it like in lazarus' desing mode? The jitforms unit is only useful if you want to write a form designer, which can load arbitrary forms with unknown classes. Normal loading/saving only needs the stuff of the RTL+LCL.

OK.

Marc Santhoff

Reply by email

Michael Van Canneyt
to Marc Santhoff
Marc Santhoff wrote 14 lines
>> by a generator program. If there is any existing code that can be reused >> it would be very helpful. > > This is too vague. What do you want to achieve? I'm thinking about a programm that: - opens a database - generates form and source for each table - uses mapping db-type -> gui component - uses configuration If you ever used the "Database Form Wizard/Assistant" of Openoffice you know what I want. Not exctly that way, but in result a basic form that can be trimmed to fit by hand afterwards.

Yes !

Please consider donating that to Lazarus :)

If you do, here some ideas:
- Allow both grid/detail form.
- Let the user control to some extent the kind of control that is generated.
- Having the ability to specify lookup controls for foreign key fields are important. That may include creating a new dataset that fetches data from the referenced table.

I have created such a wizard for Delphi (closed source) and it really helps creating forms very quickly. Having this available in Lazarus would be a real asset.

Michael.

Reply by email

Graeme Geldenhuys
to Marc Santhoff: I see. I'm thinking about a programm that: - opens a database - generates form and source…
Marc Santhoff wrote
If you ever used the "Database Form Wizard/Assistant" of Openoffice you know what I want. Not exctly that way, but in result a basic form that can be trimmed to fit by hand afterwards.

I've never tried that.... but closer to home, Delphi IDE has something similar built-in (if we are talking about the same thing). I don't know if Lazarus has that.

I don't use TDataset, so might get the terminology wrong, so bare with me. In Delphi you can hook up a TDataset to a database table. Then view the TFields of that dataset. Drag those fields and drop them on the Form Designer. The form Design will then automatically insert a TLabel and appropriate DB-aware component, and hook that up to the TDataset. You can use multi-select and drag all remember using this back in Delphi 7 days to knock out prototype applications, but that was also around the time I stopped using TDataset and DB-aware components.

Like I mentioned, I don't know if Lazarus supports that - I would be surprised if it doesn't. Lazarus has many hidden features.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Marc Santhoff
to Michael Van Canneyt: Yes ! Please consider donating that to Lazarus :) If you do, here some ideas: - Allow…
Michael Van Canneyt wrote 21 lines
On Sun, 6 Apr 2014, Marc Santhoff wrote: >>> by a generator program. If there is any existing code that can be reused >>> it would be very helpful. >> >> This is too vague. What do you want to achieve? > > I'm thinking about a programm that: > - opens a database > - generates form and source for each table > - uses mapping db-type -> gui component > - uses configuration > > If you ever used the "Database Form Wizard/Assistant" of Openoffice you > know what I want. Not exctly that way, but in result a basic form that > can be trimmed to fit by hand afterwards. Yes ! Please consider donating that to Lazarus :)

I thought about it, could be a good idea to get help.

If you do, here some ideas: - Allow both grid/detail form.

Try the Wizard of Openoffice, the third (or so) step let's the user switch between
- grid
- label above input field
- label in front of input field
- flating left to right, top to bottom (I'm not interested in this)

- Let the user control to some extent the kind of control that is generated.

See mapping above. I was thinking about a type->component list to use at generation time.

- Having the ability to specify lookup controls for foreign key fields are important. That may include creating a new dataset that fetches data from the referenced table.

I know, that's what e.g. Butler (java, on sourceforge) does. Not sure if this is too much work for a first start.

I have created such a wizard for Delphi (closed source) and it really helps creating forms very quickly. Having this available in Lazarus would be a real asset.

To reduce workload my idea is to have a standalone program. This saves me from learning Lazarus' internals and wizard API. Maybe someone else could take this task somewhen.

Currently I'm only in a pre-planning phase, my goal know is to check how much work this would be, because it's a spare time effort.

[I knew I would open a can of worms ;)]

Marc Santhoff

Reply by email