Board index » cppbuilder » Two forms talking

Two forms talking


2005-07-16 05:18:56 PM
cppbuilder95
I need to make an MDIChild window talk to its MDIForm. Specifically, I need
to be able to have a child window tell it's parent to create a new child
window.
Any one have any idea how to go about doing this?
 
 

Re:Two forms talking

Quote
Specifically, I need to be able to have a child window tell
it's parent to create a new child window.
I don't know much about MDI architecture but definitely there
can be many ways of informing MDIForm to do something.
One way could be sending custom message to MainForm's
WndProc().
--- MDI Child ---
// ...
SendMessage( Form1->Handle, MY_CREATE_NEW_FORM, 0, 0 );
// ...
--- MDI Form ( *.h ) ---
// ...
void __fastcall WndProc( TMessage & )
// ...
--- MDI Form ( *.cpp ) ---
// ...
#define MY_CREATE_NEW_FORM (WM_USER + 1000)
// ...
void __fastcall TForm1::WndProc( TMessage &Msg )
{
switch ( Msg.Msg )
{
case MY_CREATE_NEW_FORM:
// Your New Form Creation code ...
break;
// ...
}
TForm::WndProc( Msg );
}
--
Best regards,
Vladimir Stefanovic
 

Re:Two forms talking

"Vladimir Stefanovic" < XXXX@XXXXX.COM >wrote:
Quote

[...]
--- MDI Form ( *.h ) ---

// ...
void __fastcall WndProc( TMessage & )
protected: // User declarations
virtual void __fastcall WndProc( TMessage &Message );
Quote
void __fastcall TForm1::WndProc( TMessage &Msg )
I also never use Msg when it's of type TMessage because there
is a type TMsg.
~ JD
 

{smallsort}