?
Solved

Borland C++, Calling public function from parent form

Posted on 2007-11-15
4
Medium Priority
?
1,196 Views
Last Modified: 2010-04-21
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

0
Comment
Question by:avatar-e
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20290779
you have to post back a message with PostMessage() function, and override the DefWndProc() function of the parent dialog.
0
 
LVL 7

Author Comment

by:avatar-e
ID: 20290831
Ok, but can you provide a small code snippet with those instructions please (I'm mainly a C#, VB, Java developer)
0
 
LVL 86

Accepted Solution

by:
jkr earned 2000 total points
ID: 20290940
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
 
LVL 7

Author Closing Comment

by:avatar-e
ID: 31409375
Thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Know the reasons and solutions to move/import EDB to New Exchange Server. Also, find out how to recover an Exchange .edb file and to restore the file back.
IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question