【发布时间】:2018-08-08 17:20:05
【问题描述】:
我在wxWidgets 中将wxEVT_SET_FOCUS 用于wxTextCtrl。我需要做的是,当用户单击 textctrl 时,我必须打开一个新窗口并从 textctrl 中移除焦点,以便 FocusHandler 函数只执行一次。有什么功能可以从wxTextCtrl 移除焦点?
Using this connect event in constructor
//Connect Events
m_passwordText->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(MyFrame::OnPasswordTextBoxSetFocus), NULL, this);
void MyFrame::OnPasswordTextBoxSetFocus(wxFocusEvent& event)
{
if(some condition is true)
//code to open a new window
event.Skip()
// is there any option to remove focus from password textCtrl so that once a new window opens
//I can remove focus from password and avoid executing this function again and again.
// If new window opens for the first time, I perform the operation and close it
// then also it opens again as control is still in password textbox.
//Is there any way to resolve this?
}
基本上,一旦打开新窗口,我想停止处理函数的多次执行,而无需断开 wxeVT_SET_FOCUS 与 wxTextCtrl 的连接。
【问题讨论】:
标签: c++ event-handling wxwidgets