我的程序界面如下图,在工具栏中有一些按钮,按钮控制formview1内容的变化。我现在遇到一个问题:如果焦点在formview2上的时候,点击按钮的时候formview1的内容不能刷新,怎么办啊?工具栏按钮的点击函数是formview1的成员函数+------------------------------------------+
|工具栏 |
| |
+------------------------------------------+
|Formview1 |
| |
| |
| |
| |
| |
+------------------------------------------+
|Formview2 |
| |
| |
| |
| |
| |
+------------------------------------------+
|工具栏 |
| |
+------------------------------------------+
|Formview1 |
| |
| |
| |
| |
| |
+------------------------------------------+
|Formview2 |
| |
| |
| |
| |
| |
+------------------------------------------+
void CSDIView::OnTest()
{
// TODO: Add your control notification handler code here
CSDIDoc*pDoc=GetDocument();
pDoc->SetText(m_text);
UpdateData();
pDoc->UpdateAllViews(this);
}void CTextView::OnDraw(CDC* pDC)
{
CSDIDoc * pDoc = GetDocument();
// TODO: add draw code here
CString m_text;
m_text=pDoc->GetText();
m_textOut.Format("context: %s",m_text);
pDC->TextOut(10,20,m_textOut);
}可是我要按两次Test按钮FormView2才会更新,是怎么回事啊?
你说的详细些。最后把代码贴出来。是分割视图吗?