Discussion:
combine Form components from 2 Applications
(too old to reply)
Sudesh
2007-10-09 13:02:28 UTC
Permalink
I have 2 applications having single Form each, with many components with
events.
I wish to combine both i.e. bring components from 2nd applications MainForm
to the 1st applications MainForm.

I can copy components
-- on the Form, I copy button foo.

and copy event's code
-- in header file I copy the following
void __fastcall fooClick(TObject *Sender);

-- in cpp unit file I copy the following
void __fastcall TForm1::fooClick(TObject *Sender)
{
// code ....
}

Now how do I generate reference to this OnClick() event of button foo?
(Which we normally do by doubleclicking OnClick event in the Object
Inspector)

Hope I am able to explain what I wish to do.

Thanks,
Sudesh
Heath Raftery
2007-10-10 00:23:30 UTC
Permalink
Post by Sudesh
I have 2 applications having single Form each, with many components with
events.
I wish to combine both i.e. bring components from 2nd applications MainForm
to the 1st applications MainForm.
I can copy components
-- on the Form, I copy button foo.
and copy event's code
-- in header file I copy the following
void __fastcall fooClick(TObject *Sender);
-- in cpp unit file I copy the following
void __fastcall TForm1::fooClick(TObject *Sender)
{
// code ....
}
Now how do I generate reference to this OnClick() event of button foo?
(Which we normally do by doubleclicking OnClick event in the Object
Inspector)
This is stored in the dfm file. If you specify that your dfm should be
stored as text (in the designer's context menu for the form) then you'll
be able to see the assigment by viewing the form as text.
--
*--------------------------------------------------------*
| ^Nothing is foolproof to a sufficiently talented fool^ |
| Heath Raftery, HRSoftWorks _\|/_ |
*______________________________________m_('.')_m_________*
Sudesh
2007-10-10 00:39:53 UTC
Permalink
Thanks Heath

what is the efficient way to do the task i explained?

Sudesh
Post by Heath Raftery
This is stored in the dfm file. If you specify that your dfm should be
stored as text (in the designer's context menu for the form) then you'll
be able to see the assigment by viewing the form as text.
Clayton Arends
2007-10-10 17:01:28 UTC
Permalink
- Copy the code from the CPP and H files
- Copy the visual components

If you do it in that order the IDE will find the event handlers and
everything will be fine.

HTH,
Clayton
Sudesh
2007-10-11 01:12:04 UTC
Permalink
Post by Clayton Arends
- Copy the code from the CPP and H files
- Copy the visual components
i had done that. but in additon i had to open DFM file in text form and copy
events for each component.
thanks,
sudesh
Clayton Arends
2007-10-11 16:13:50 UTC
Permalink
... but in additon i had to open DFM file in text form and copy
I believed this to work but apparently the IDE only fixes up object
references and not event handlers.

Then, with this in mind, a better sequence would be:

1. Copy the event handler declarations from the H file
2. Copy the object pointer declarations from the H file
3. Copy the event handler definitions from the CPP file
4. Visually copy the objects from the source form (faster than from DFM)
5. View the destination form's DFM as text
6. Paste

HTH,
Clayton

Continue reading on narkive:
Loading...