Link to home
Start Free TrialLog in
Avatar of avatar-e
avatar-eFlag for Chile

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( ... ) ?
}

Open in new window

Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

you have to post back a message with PostMessage() function, and override the DefWndProc() function of the parent dialog.
Avatar of avatar-e

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
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks