基于CFormView的SDI SPlitterWnd分割Sdi后,创建左右两个基于FormView的两个视图,如何实现相应的控件消息?

bluevox3000 2008-10-19 12:02:20
如题,左右两个视图,每个视图中都有相应的原来为对话框中的控件,显示在了分割后的FormView中,可是对于原来可以用对话框实现的消息都不管用了。比如“确定”按钮,添加OnOK,MessageBox("哈哈"); ,在运行后的视 中点击这个按钮,却没有MessageBox对话框弹出,如何实现 ?才能够点击按钮,弹出“ 哈哈”?
谢谢
基于CFormView的SDI SPlitterWnd分割Sdi后,创建左右两个基于FormView的两个视图,如何实现相应的控件消息?
...全文
74 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
bluevox3000 2008-10-20
  • 打赏
  • 举报
回复
To create a button on a form that closes the document, use ClassWizard to add a message handler for the BN_CLICKED message to the CFormView class. Make sure that the buttons in CFormView do not have the default IDOK or IDCANCEL identifiers. If they do, ClassWizard creates incorrect entries in the message map and incorrect functions for the buttons.

Once the message handler is in place, you can simulate the Close command on the File menu with the following code:

void CMyForm::OnClickedButton1()
{
PostMessage(WM_COMMAND, ID_FILE_CLOSE);
}
This method to close a form prompts the user to save the file if the IsModified() member function associated with the document returns TRUE.
bluevox3000 2008-10-20
  • 打赏
  • 举报
回复
w我这个问题,很简单,对高手。
bluevox3000 2008-10-19
  • 打赏
  • 举报
回复
Pane1View ----IDD_DIALOG1 有若干控件
Pane2View ----IDD_DIALOG2 有若干控件

均继承自CFormView,


SDI ,CFormView,建立单文档,然后分割视图为左右,左侧显示----IDD_DIALOG1

右侧显示----IDD_DIALOG2


运行以后,如何区分鼠标点击的是IDD_DIALOG1中的哪个具体控件(按钮)?比如实现对话框中的不同的若干个按钮点击事件。

lihongbin33 2008-10-19
  • 打赏
  • 举报
回复
能不能说明白点?

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧