如何在视图中添加回车按键消息,使按下回车就能发送消息,而不是点发送按钮
视图类CChatView,CEdit编辑框,ID为IDC_CHATDATA,绑定变量为m_wndChatData跟重写OnOk函数无关吧,IDOK按钮也没有,求指导~vo...
视图类CChatView,CEdit编辑框,ID为 IDC_CHATDATA,绑定变量为m_wndChatData
跟重写OnOk函数无关吧,IDOK按钮也没有,求指导~
void CChatView::OnSend() { if( NULL == m_pUserClient ) { return; }
CString strChat; m_wndChatData.GetWindowText( strChat ); int nSel = m_wndChatUser.GetCurSel( ); if( nSel == 0 ) { m_pUserClient->SendChat( "", strChat ); m_wndChatData.SetWindowText(""); } else { CString strIP; m_wndChatUser.GetLBText( nSel, strIP ); m_pUserClient->SendChat( strIP, strChat, FALSE ); m_wndChatData.SetWindowText(""); } //GetDlgItem(IDC_CHATDATA)->SetFocus();} 展开
跟重写OnOk函数无关吧,IDOK按钮也没有,求指导~
void CChatView::OnSend() { if( NULL == m_pUserClient ) { return; }
CString strChat; m_wndChatData.GetWindowText( strChat ); int nSel = m_wndChatUser.GetCurSel( ); if( nSel == 0 ) { m_pUserClient->SendChat( "", strChat ); m_wndChatData.SetWindowText(""); } else { CString strIP; m_wndChatUser.GetLBText( nSel, strIP ); m_pUserClient->SendChat( strIP, strChat, FALSE ); m_wndChatData.SetWindowText(""); } //GetDlgItem(IDC_CHATDATA)->SetFocus();} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询