Sign in Join

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

Mailing lists / lazarus / 2003-11

Form structure by class reference?

8 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

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

Tony Maro

Is it possible to discern the structure of a custom form class without creating the form?

I.E. I want to have a form in a project that has controls on it, but NOT create the just want to read what components were designed into it, and where they are supposed to be located on the form _if_ it were created.

Thanks,

Tony Maro Systems Consultant The Maro Group (256) 337-5759 http://www.maro.net/

Reply by email

Michael Van Canneyt
to Tony Maro: Well, I've got this bright idea of an ISAPI interface that would create HTML forms from…
Tony Maro wrote 29 lines
> -----Original Message----- > From: Mattias Gaertner > > On Fri, 07 Nov 2003 09:30:07 -0600 > Tony Maro wrote: > > > Is it possible to discern the structure of a custom form > class without > > creating the form? > > > > (The codetools are capable to scan the lrs/lfm information > and to create a lfm source tree). > > What information do you need? > Well, I've got this bright idea of an ISAPI interface that would create HTML forms from simple Lazarus forms. So, what I'm after is what controls are on the form (label, text, checkbox, buttons, etc.) and the position so I can create an HTML form based on it. I might even create my own special visual components for dropping on a form that are especially suited to HTML formatting. I already have the ISAPI component basics completed but wanted an easier way to display the data on a webpage than hand-coding HTML for it. Since it's a console only app, I have no need to actually create the form, I just want to know how it's organized.

I think the best way is to make it XML.

There is a basic XML streamer for the FCL. It simply needs to be put in Lazarus, so lazarus could stream/export the form to XML, and you could analyze the XML.

(note: I don't propose to make this XML the default streaming format, just an export...)

Michael.

Reply by email

Tony Maro
to Mattias Gaertner: On Fri, 07 Nov 2003 09:30:07 -0600 Not easily. The form component information is kept in…
Show quoted text 16 lines
-----Original Message----- From: Mattias Gaertner On Fri, 07 Nov 2003 09:30:07 -0600 Tony Maro wrote: > Is it possible to discern the structure of a custom form class without > creating the form? > (The codetools are capable to scan the lrs/lfm information and to create a lfm source tree). What information do you need?

Well, I've got this bright idea of an ISAPI interface that would create HTML forms from simple Lazarus forms. So, what I'm after is what controls are on the form (label, text, checkbox, buttons, etc.) and the position so I can create an HTML form based on it. I might even create my own special visual components for dropping on a form that are especially suited to HTML formatting.

I already have the ISAPI component basics completed but wanted an easier way to display the data on a webpage than hand-coding HTML for it.

Since it's a console only app, I have no need to actually create the form, I just want to know how it's organized.

Thanks,

-Tony Maro

Reply by email

Mattias Gaertner
to Tony Maro
Show quoted text 42 lines
On Fri, 7 Nov 2003, Tony Maro wrote: > > -----Original Message----- > > From: Mattias Gaertner > > > > On Fri, 07 Nov 2003 09:30:07 -0600 > > Tony Maro wrote: > > > > > Is it possible to discern the structure of a custom form > > class without > > > creating the form? > > > > > > > (The codetools are capable to scan the lrs/lfm information > > and to create a lfm source tree). > > > > What information do you need? > > > > Well, I've got this bright idea of an ISAPI interface that would create > HTML forms from simple Lazarus forms. So, what I'm after is what > controls are on the form (label, text, checkbox, buttons, etc.) and the > position so I can create an HTML form based on it. I might even create > my own special visual components for dropping on a form that are > especially suited to HTML formatting. > > I already have the ISAPI component basics completed but wanted an easier > way to display the data on a webpage than hand-coding HTML for it. > > Since it's a console only app, I have no need to actually create the > form, I just want to know how it's organized. I think the best way is to make it XML. There is a basic XML streamer for the FCL. It simply needs to be put in Lazarus, so lazarus could stream/export the form to XML, and you could analyze the XML. (note: I don't propose to make this XML the default streaming format, just an export...)

I'm not sure, if this feature will be used often.
Maybe it is sufficient to write a small lfm2xml program and add it to the tools directory?

Mattias

Reply by email

Mattias Gaertner
to Mattias Gaertner
Show quoted text 13 lines
Well, all sound like good ideas... From what I can see it looks like it shouldn't be too hard to interpret the form resource data. But, can you point me in the right direction of what to use? I know how to find the resource itself and put it into a stream, I think. After that I assume there's a routine that will convert that stream back to the text format that makes up the lfm file? From there it should be simple to parse...

ObjectBinaryToText in classes.pp.

Mattias

Reply by email

Mattias Gaertner
to Tony Maro: Is it possible to discern the structure of a custom form class without creating the form?…
Show quoted text 7 lines
Is it possible to discern the structure of a custom form class without creating the form? I.E. I want to have a form in a project that has controls on it, but NOT create the just want to read what components were designed into it, and where they are supposed to be located on the form _if_ it were created.

Not easily.
The form component information is kept in the .lrs file, which is included as lazarus resource. The LCL fetches this information and creates a TReader, which creates the components. The exact nature is determined by the components itself. So, the only 100% reliable way is to create it.

(The codetools are capable to scan the lrs/lfm information and to create a lfm source tree).

What information do you need?

Mattias

Reply by email

Unknown author
to Tony Maro: Well, I've got this bright idea of an ISAPI interface that would create HTML forms from…
Mattias Gaertner wrote 49 lines
On Fri, 7 Nov 2003 18:30:03 +0100 (W. Europe Standard Time) Michael Van Canneyt wrote: > > > On Fri, 7 Nov 2003, Tony Maro wrote: > > > > -----Original Message----- > > > From: Mattias Gaertner > > > > > > On Fri, 07 Nov 2003 09:30:07 -0600 > > > Tony Maro wrote: > > > > > > > Is it possible to discern the structure of a custom form > > > class without > > > > creating the form? > > > > > > > > > > (The codetools are capable to scan the lrs/lfm information > > > and to create a lfm source tree). > > > > > > What information do you need? > > > > > > > Well, I've got this bright idea of an ISAPI interface that would create > > HTML forms from simple Lazarus forms. So, what I'm after is what > > controls are on the form (label, text, checkbox, buttons, etc.) and the > > position so I can create an HTML form based on it. I might even create > > my own special visual components for dropping on a form that are > > especially suited to HTML formatting. > > > > I already have the ISAPI component basics completed but wanted an easier > > way to display the data on a webpage than hand-coding HTML for it. > > > > Since it's a console only app, I have no need to actually create the > > form, I just want to know how it's organized. > > I think the best way is to make it XML. > > There is a basic XML streamer for the FCL. It simply needs to be > put in Lazarus, so lazarus could stream/export the form to XML, > and you could analyze the XML. > > (note: I don't propose to make this XML the default streaming format, > just an export...) I'm not sure, if this feature will be used often. Maybe it is sufficient to write a small lfm2xml program and add it to the tools directory?

It's also possible of course, though I think it will be more work, as you have to parse the .lfm. But it's worth a shot.

Michael.

Reply by email