Forum > Beginners

Problem with Inherited project component


Gerrit Hoevers:

I created a form with a button on it, and then a second form via New -> Inherited project component. The new form is visible, the name can be altered, etc. but the button isn't visible, so I can't change it's caption. In runtime the button is visible, but that doesn't help me.
Can anyone help?

I think the Inherited Project component functionality is intended for use with components other than forms (which are unique components in several ways).

Although you can set the inherited form's button's properties in code (say in the form's OnCreate event), you'll run into other problems using inherited forms, and as you have noticed the Object Inspector does not register their inherited published properties, so the Form Designer is unable to deal with them.

The component which has been designed to give you the inherited functionality you are after is TFrame.
Create a frame with buttons etc. on it, and you should be able to use it without any of these problems.

Inherited project component is for forms too, I use it for tool windows. I have TemplateForm with some buttons and header for close, dock and undock and descendant tool windows.
However, it took me a while to learn how to deal with it.

1) *.lfm of descendants does not contain all info, but instead of object there's keyword inherited and only those properties that differ from ancestor form are streamed.

2) If you change something on ancestor form, the changes does not affect descendant forms immediatelly. They will appear, however, if you restart Lazarus or reload project.

But in general, it works well.

So, try to check *.lfm files, (close project before you will edit them) then restart project, let's see what will happen.

Gerrit Hoevers:
Thank you both. I don't have much time now to check it all out, and don't exactly know what I am doing yet ... but by opening the .lfm file (whit Lazarus!) I have access now to the properties of the button on the child form.
It also is now visible on the form in the IDE and the caption can be changed, so now it is "really" a different button then that of the parent form.


[0] Message Index

Go to full version