Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Catching Button Clicks On A Dialog From Doc Class

Status
Not open for further replies.

forlorn

Programmer
Dec 12, 2001
28
0
0
TR
Hi,

I have a dialog which have a button on it.
I want to do one of the following :

1) As the title tells, catch the button click from doc class. As an instance of this dialog is a member variable of doc class.

like,

if( dlgInstance.m_buttonInstance. ...( something like OnClick() )
{
ADocMemberFunction();
}

2) or to get a pointer to the doc class in dialog, like the GetDocument() function in view class.

like,

// dialog.cpp

OnButton()
{
GetTheDoc()->ADocMemberFunction();
}

CTheAppDoc* CTheDialog::GetTheDoc()
{
......
}

Any idea about which method to choose and how to perform this task with the chosen method?
I really need to replace those dots with real code! :)

Thanks in advance.




 
It is easier to get the document in your dialog.
First you must have had a theApp object which is the instance your app class. include the needed head files into your dialog class, then add the following into your Get the doc function:

CDocument*pDoc = (CDocument*)(((CFrameWnd*)theApp.m_pMainWnd)->GetActiveDocument());
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top