Hi.
I've a Form (TFrmMain) with a button (Btn1) on it.
I created an OnClick event procedure for Btn1 (FrmMainBtn1_OnClick).
Then I created two forms TFrmForm1 and TFrmForm2 both subclasses of TFrmMain.
How? how did you subclassed form1 and form2 from the frmMain?
I inserted a button in TFrmForm1, named it Btn1 (as on TFrmMain) and create a OnClick event procedure (Form1Btn1_OnClick).
if you have properly subclasses frmMain you should be able to see the button you placed on frmMain on form1 and form2 you will not need to add it again.
When I compiled and error occurred: Duplicate Name: A component named "Btn1" already exists.
ofcourse it exists you already said you have a button with the same name on the parent form.
I've to remove Btn1 to compile the program.
you could also rename it to a non existing name.
If I run the program the Btn1 appears on TfrmForm1. When I clicked on this button the Form1Btn1_OnClick procedure is executed (instead of FrmMainBtn1_OnClick)
Is it a normal behaviour?
Yes it is normal to be able to override the click event on a child form.
In any case I found it really usefull to create a hierarchy of Forms and to manage the logic to show button at top level having different procedure linked to same buttons.
Do it properly then don't short circuit the IDE. Select the menu File\New on the tree on the left select inherited project component and on the list on the right select your form to inherit from and press ok.