本文整理汇总了C++中wxKeyEvent::DoAllowNextEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ wxKeyEvent::DoAllowNextEvent方法的具体用法?C++ wxKeyEvent::DoAllowNextEvent怎么用?C++ wxKeyEvent::DoAllowNextEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxKeyEvent
的用法示例。
在下文中一共展示了wxKeyEvent::DoAllowNextEvent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnCharHook
void wxButton::OnCharHook(wxKeyEvent& event)
{
// We want to ensure that the button always processes Enter key events
// itself, even if it's inside some control that normally takes over them
// (this happens when the button is part of an in-place editor control for
// example).
if ( event.GetKeyCode() == WXK_RETURN )
{
// We should ensure that subsequent key events are still generated even
// if we did handle EVT_CHAR_HOOK (normally this would suppress their
// generation).
event.DoAllowNextEvent();
}
else
{
event.Skip();
}
}
示例2: OnCharHook
void OnCharHook( wxKeyEvent& aEvent )
{
// On certain platforms, EVT_CHAR_HOOK is the only handler that receives
// certain "special" keys. However, it doesn't always receive "normal"
// keys correctly. For example, with a US keyboard, it sees ? as shift+/.
//
// Untangling these incorrect keys would be too much trouble, so we bind
// both events, and simply skip the EVT_CHAR_HOOK if it receives a
// "normal" key.
const enum wxKeyCode skipped_keys[] =
{
WXK_NONE, WXK_SHIFT, WXK_ALT, WXK_CONTROL, WXK_CAPITAL,
WXK_NUMLOCK, WXK_SCROLL, WXK_RAW_CONTROL
};
int key = aEvent.GetKeyCode();
for( size_t i = 0; i < sizeof( skipped_keys ) / sizeof( skipped_keys[0] ); ++i )
{
if( key == skipped_keys[i] )
return;
}
if( key <= 255 && isprint( key ) && !isspace( key ) )
{
// Let EVT_CHAR handle this one
aEvent.DoAllowNextEvent();
// On Windows, wxEvent::Skip must NOT be called.
// On Linux and OSX, wxEvent::Skip MUST be called.
// No, I don't know why.
#ifndef __WXMSW__
aEvent.Skip();
#endif
}
else
{
OnChar( aEvent );
}
}
示例3: OnChar
void FrequencyDialog::OnChar(wxKeyEvent& event) {
int c = event.GetKeyCode();
long long freq;
std::string lastDemodType = activeDemod?activeDemod->getDemodulatorType():wxGetApp().getDemodMgr().getLastDemodulatorType();
switch (c) {
case WXK_RETURN:
case WXK_NUMPAD_ENTER:
// Do Stuff
freq = strToFrequency(dialogText->GetValue().ToStdString());
if (targetMode == FDIALOG_TARGET_DEFAULT) {
if (activeDemod) {
activeDemod->setTracking(true);
activeDemod->setFollow(true);
activeDemod->setFrequency(freq);
activeDemod->updateLabel(freq);
} else {
wxGetApp().setFrequency(freq);
}
}
if (targetMode == FDIALOG_TARGET_BANDWIDTH) {
if (lastDemodType == "USB" || lastDemodType == "LSB") {
freq *= 2;
}
if (activeDemod) {
activeDemod->setBandwidth(freq);
} else {
wxGetApp().getDemodMgr().setLastBandwidth(freq);
}
}
Close();
break;
case WXK_ESCAPE:
Close();
break;
}
std::string allowed("0123456789.MKGHZmkghz");
if (allowed.find_first_of(c) != std::string::npos || c == WXK_DELETE || c == WXK_BACK || c == WXK_NUMPAD_DECIMAL
|| (c >= WXK_NUMPAD0 && c <= WXK_NUMPAD9)) {
#ifdef __linux__
dialogText->OnChar(event);
event.Skip();
#else
event.DoAllowNextEvent();
#endif
} else if (event.ControlDown() && c == 'V') {
// Alter clipboard contents to remove unwanted chars
wxTheClipboard->Open();
wxTextDataObject data;
wxTheClipboard->GetData(data);
std::string clipText = data.GetText().ToStdString();
std::string pasteText = filterChars(clipText, std::string(allowed));
wxTheClipboard->SetData(new wxTextDataObject(pasteText));
wxTheClipboard->Close();
event.Skip();
} else if (c == WXK_RIGHT || c == WXK_LEFT || event.ControlDown()) {
event.Skip();
}
}