Graeme Geldenhuys wrote:
Thanks for those pointers. I will work through the main.pp unit next.
Regards,
- Graeme -
On 03/05/06, Mattias Gaertner <[EMAIL PROTECTED]> wrote:
On Wed, 3 May 2006 14:46:27 +0200
"Graeme Geldenhuys" <[EMAIL PROTECTED]> wrote:
> Hi
>
> I am trying to see where the missing code would go to get Visual Form
> Inheritance working in the Designer. Or at least make some headway to
> get it working. What would be involved to get it to work?
>
> First things first, I would need to familiarise myself with the
> internals of the Form Designer. Could someone give a brief
> description of what happens when Lazarus loads a .lfm file and maybe
> mention the related unit files the work happens in?
>
> I would imagine it goes something like this:
>
> 1) Parse the .lfm file into memory (I guess into some tree
> structure). Who does this, TReader?
> 2) Run through the tree structure and create each component in turn
> 2.1) setting the appropriate properties from what was read in the
.lfm
> file 2.2) tell the component to paint itself.
> 3) keep repeating 2) until the designer has worked through the whole
> tree structure.
> 4) show the designer form.
main.pp :
TMainIDE.DoLoadLFM:
- load needed packages
- find the classname of the LFM, and check for inherited form
- find the ancestor type in the source
- load the ancestor first
TMainIDE.DoLoadAncestorComponent
- search used units filenames
- test every .lfm to find the ancestor lfm
// TODO: open ancestor hidden
// WORKAROUND: just open it
// beware: don't close it or you will get strange errors
back in TMainIDE.DoLoadLFM:
- load lfm
- convert it to binary format (LRSObjectTextToBinary)
- create JIT component
TCustomFormEditor.CreateComponentFromStream in ide/customformeditor.pp
TJITComponentList.AddJITComponentFromStream
- create a new VMT
- create a Reader with LResources.CreateLRSReader
- Reader.ReadRootComponent
back in TMainIDE.DoLoadLFM:
- create a designer
TMainIDE.CreateDesignerForComponent
What is needed:
- The ancestor class must be loaded and referenced, so that the ancestor
form is not closed before the inherited form. Either by disallowing to
close
a unit or better: by keeping the ancestor form and only hide it
- Define and implement how to edit inherited controls on the form.
- Define and implement how to edit the ancestor form, when inherited
forms
are open.
- Implement menu items/dialogs to create an inherited form and to
register
forms for the New dialog.
> As far as I remember, someone has already worked on the parsing of the
> .lfm file to not complain when Visual Form Inheritance was used. My
> mailing list archive doesn't go that far back, so can't remember who
> that was.
The discussion is on gmane at :
http://thread.gmane.org/gmane.comp.ide.lazarus.general/1253/focus=1253
I can confirm that inherited forms still load in programs fine, but the
stuff to avoid error messages when loading in the ide needs a couple of
fixes, possibly because of later changes.
Colin
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives