Fix special hotkeys on Windows

This commit is contained in:
Chris Pavlina 2016-01-15 21:06:59 -05:00 committed by Chris Pavlina
parent 14008321fe
commit f574620d07
1 changed files with 27 additions and 3 deletions

View File

@ -68,6 +68,7 @@ public:
: m_hotkey( aHotkey ), m_section_tag( aSectionTag )
{}
EDA_HOTKEY& GetHotkey() { return m_hotkey; }
const wxString& GetSectionTag() const { return m_section_tag; }
};
@ -123,7 +124,6 @@ public:
key_label_1->SetFont( key_label_1->GetFont().Bold().MakeLarger() );
fgsizer->Add( key_label_1, 0, wxALL | wxALIGN_CENTRE_VERTICAL, 5 );
sizer->Add( fgsizer, 1, wxEXPAND );
// Wrap the sizer in a second to give a larger border around the whole dialog
@ -137,14 +137,38 @@ public:
SetMinClientSize( GetClientSize() );
// Binding both EVT_CHAR and EVT_CHAR_HOOK to the same handler ensures that
// all key events, including specials like Tab and Return, are received,
// particularly on MSW.
panel->Bind( wxEVT_CHAR, &HK_PROMPT_DIALOG::OnChar, this );
panel->Bind( wxEVT_CHAR_HOOK, &HK_PROMPT_DIALOG::OnChar, this );
}
void OnChar( wxKeyEvent& aEvent )
{
long key = aEvent.GetKeyCode();
// Some of these keys are duplicates on some platforms, so a switch()
// won't work.
if( key == WXK_NONE
|| key == WXK_SHIFT
|| key == WXK_ALT
|| key == WXK_CONTROL
|| key == WXK_CAPITAL
|| key == WXK_NUMLOCK
|| key == WXK_SCROLL
|| key == WXK_RAW_CONTROL
|| key == WXK_COMMAND
)
{
return;
}
else
{
m_event = aEvent;
EndFlexible( wxID_OK );
}
}
/**
* End the dialog whether modal or quasimodal