accessing parent form from a child form.how?

N

nass

hello everyone,

i have a mainForm, that is run basically from main.cpp.
then i also have a childForm, that gets instanciated from within a
function in mainForm. basically:

#include "childrenforms.h"

//etcetc

class childrenForms;

//etcetc

childrenForms *childForm;

//etcetc

mainForm::showChildForm()
{
childForm = new childrenForm(..);
childForm.show(); //to prepare the form for showing on screen
childForm.exec(); //to run it
}

so far so good... however the mainForm also has a writeToFile()
function..

mainForm::writeToFile() {....}

i need to make this visible to the childForm...
so that i can basically somehow run the mainForm->writeToFile()
function by calling it from within the childForm.
how can i do that?
thank you for your help
nass
 
R

rexonf

nass said:
hello everyone,

i have a mainForm, that is run basically from main.cpp.
then i also have a childForm, that gets instanciated from within a
function in mainForm. basically:

#include "childrenforms.h"

//etcetc

class childrenForms;

//etcetc

childrenForms *childForm;

//etcetc

mainForm::showChildForm()
{
childForm = new childrenForm(..);
childForm.show(); //to prepare the form for showing on screen
childForm.exec(); //to run it
}

so far so good... however the mainForm also has a writeToFile()
function..

mainForm::writeToFile() {....}

i need to make this visible to the childForm...
so that i can basically somehow run the mainForm->writeToFile()
function by calling it from within the childForm.
how can i do that?
thank you for your help
nass

Pass a pointer to the child form:

mainForm::showChildForm()
{
childForm = new childrenForm(this);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top