avatar-e
asked on
Borland C++, Calling public function from parent form
I have 2 forms. TBowling calls TFormGame, but how can I call MoveBowlingPin from TFormGame?
__fastcall TBowling::TBowling(TComponent* Owner)
: TForm(Owner)
{
FormGame = new TFormGame(this);
FormGame->Show();
}
void TBowling::MoveBowlingPin(int id, double x, double y, double z, double rx, double ry, double rz)
{
for(int i=0;i<Figures->Count;i++)
{
Figure3d *figure = ((Figure3d*)Figures->Items[i]);
if(figure->kind == id)
{
figure->Move(x,y,z);
figure->Rotate(rx,ry,rz);
}
}
}
// --------------------------------------------------
__fastcall TFormGame::TFormGame(TComponent* Owner)
: TForm(Owner)
{
// Code to call
// MoveBowlingPin( ... ) ?
}
you have to post back a message with PostMessage() function, and override the DefWndProc() function of the parent dialog.
ASKER
Ok, but can you provide a small code snippet with those instructions please (I'm mainly a C#, VB, Java developer)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks