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

LVL 7
avatar-eAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
jkrConnect With a Mentor Commented:
Since your 'TBowling' class is the owner of 'TFormGame', you could just

__fastcall TFormGame::TFormGame(TComponent* Owner)
    : TForm(Owner)
{
    TBowling* p =(TBowling*) Owner;
   
    p->MoveBowlingPin( ... );
}
0
 
Jaime OlivaresSoftware ArchitectCommented:
you have to post back a message with PostMessage() function, and override the DefWndProc() function of the parent dialog.
0
 
avatar-eAuthor Commented:
Ok, but can you provide a small code snippet with those instructions please (I'm mainly a C#, VB, Java developer)
0
 
avatar-eAuthor Commented:
Thanks
0
All Courses

From novice to tech pro — start learning today.