Fix special hotkeys on Windows
This commit is contained in:
parent
14008321fe
commit
f574620d07
|
@ -68,6 +68,7 @@ public:
|
||||||
: m_hotkey( aHotkey ), m_section_tag( aSectionTag )
|
: m_hotkey( aHotkey ), m_section_tag( aSectionTag )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
EDA_HOTKEY& GetHotkey() { return m_hotkey; }
|
EDA_HOTKEY& GetHotkey() { return m_hotkey; }
|
||||||
const wxString& GetSectionTag() const { return m_section_tag; }
|
const wxString& GetSectionTag() const { return m_section_tag; }
|
||||||
};
|
};
|
||||||
|
@ -123,7 +124,6 @@ public:
|
||||||
key_label_1->SetFont( key_label_1->GetFont().Bold().MakeLarger() );
|
key_label_1->SetFont( key_label_1->GetFont().Bold().MakeLarger() );
|
||||||
fgsizer->Add( key_label_1, 0, wxALL | wxALIGN_CENTRE_VERTICAL, 5 );
|
fgsizer->Add( key_label_1, 0, wxALL | wxALIGN_CENTRE_VERTICAL, 5 );
|
||||||
|
|
||||||
|
|
||||||
sizer->Add( fgsizer, 1, wxEXPAND );
|
sizer->Add( fgsizer, 1, wxEXPAND );
|
||||||
|
|
||||||
// Wrap the sizer in a second to give a larger border around the whole dialog
|
// Wrap the sizer in a second to give a larger border around the whole dialog
|
||||||
|
@ -137,14 +137,38 @@ public:
|
||||||
|
|
||||||
SetMinClientSize( GetClientSize() );
|
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, &HK_PROMPT_DIALOG::OnChar, this );
|
||||||
|
panel->Bind( wxEVT_CHAR_HOOK, &HK_PROMPT_DIALOG::OnChar, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnChar( wxKeyEvent& aEvent )
|
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;
|
m_event = aEvent;
|
||||||
EndFlexible( wxID_OK );
|
EndFlexible( wxID_OK );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End the dialog whether modal or quasimodal
|
* End the dialog whether modal or quasimodal
|
||||||
|
|
Loading…
Reference in New Issue