fix(modulo): fix form return key shortcut not working when ListBox component was selected. Fix #857
This commit is contained in:
parent
06f990fbd7
commit
b2e6a8c8cc
|
@ -96,6 +96,7 @@ private:
|
||||||
void Submit();
|
void Submit();
|
||||||
void OnSubmitBtn(wxCommandEvent& event);
|
void OnSubmitBtn(wxCommandEvent& event);
|
||||||
void OnCharHook(wxKeyEvent& event);
|
void OnCharHook(wxKeyEvent& event);
|
||||||
|
void OnListBoxEvent(wxCommandEvent& event);
|
||||||
void UpdateHelpText();
|
void UpdateHelpText();
|
||||||
void HandleNormalFocus(wxFocusEvent& event);
|
void HandleNormalFocus(wxFocusEvent& event);
|
||||||
void HandleMultilineFocus(wxFocusEvent& event);
|
void HandleMultilineFocus(wxFocusEvent& event);
|
||||||
|
@ -141,7 +142,6 @@ FormFrame::FormFrame(const wxString& title, const wxPoint& pos, const wxSize& si
|
||||||
|
|
||||||
Bind(wxEVT_BUTTON, &FormFrame::OnSubmitBtn, this, ID_Submit);
|
Bind(wxEVT_BUTTON, &FormFrame::OnSubmitBtn, this, ID_Submit);
|
||||||
Bind(wxEVT_CHAR_HOOK, &FormFrame::OnCharHook, this, wxID_ANY);
|
Bind(wxEVT_CHAR_HOOK, &FormFrame::OnCharHook, this, wxID_ANY);
|
||||||
// TODO: register ESC click handler: https://forums.wxwidgets.org/viewtopic.php?t=41926
|
|
||||||
|
|
||||||
this->SetClientSize(panel->GetBestSize());
|
this->SetClientSize(panel->GetBestSize());
|
||||||
this->CentreOnScreen();
|
this->CentreOnScreen();
|
||||||
|
@ -218,6 +218,11 @@ void FormFrame::AddComponent(wxPanel *parent, wxBoxSizer *sizer, FieldMetadata m
|
||||||
}
|
}
|
||||||
|
|
||||||
((wxListBox*)choice)->Bind(wxEVT_SET_FOCUS, &FormFrame::HandleNormalFocus, this, wxID_ANY);
|
((wxListBox*)choice)->Bind(wxEVT_SET_FOCUS, &FormFrame::HandleNormalFocus, this, wxID_ANY);
|
||||||
|
// ListBoxes prevent the global CHAR_HOOK handler from handling the Return key
|
||||||
|
// correctly, so we need to handle the double click event too (which is triggered
|
||||||
|
// when the enter key is pressed).
|
||||||
|
// See: https://github.com/federico-terzi/espanso/issues/857
|
||||||
|
((wxListBox*)choice)->Bind(wxEVT_LISTBOX_DCLICK, &FormFrame::OnListBoxEvent, this, wxID_ANY);
|
||||||
|
|
||||||
// Create the field wrapper
|
// Create the field wrapper
|
||||||
std::unique_ptr<FieldWrapper> field((FieldWrapper*) new ListFieldWrapper((wxListBox*) choice));
|
std::unique_ptr<FieldWrapper> field((FieldWrapper*) new ListFieldWrapper((wxListBox*) choice));
|
||||||
|
@ -311,6 +316,10 @@ void FormFrame::OnCharHook(wxKeyEvent& event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FormFrame::OnListBoxEvent(wxCommandEvent& event) {
|
||||||
|
Submit();
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" void interop_show_form(FormMetadata * _metadata, void (*callback)(ValuePair *values, int size, void *data), void *data) {
|
extern "C" void interop_show_form(FormMetadata * _metadata, void (*callback)(ValuePair *values, int size, void *data), void *data) {
|
||||||
// Setup high DPI support on Windows
|
// Setup high DPI support on Windows
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
|
|
Loading…
Reference in New Issue
Block a user