Fix forwarding of menu commands in the richtext sample
Fall back on the main rich text control if there is no currently focused window, as the control itself never has focus when a menu is opened with wxGTK/Wayland, i.e. none of the menu commands, such as wxID_COPY/CUT, worked for it in this case. Closes #22121.
This commit is contained in:
parent
7e45373e16
commit
0390951677
1 changed files with 4 additions and 0 deletions
|
|
@ -757,6 +757,8 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos,
|
|||
const wxSize& size, long style)
|
||||
: wxFrame(NULL, id, title, pos, size, style)
|
||||
{
|
||||
m_richTextCtrl = NULL;
|
||||
|
||||
#ifdef __WXMAC__
|
||||
SetWindowVariant(wxWINDOW_VARIANT_SMALL);
|
||||
#endif
|
||||
|
|
@ -1339,6 +1341,8 @@ bool MyFrame::ProcessEvent(wxEvent& event)
|
|||
s_id = event.GetId();
|
||||
|
||||
wxWindow* focusWin = wxFindFocusDescendant(this);
|
||||
if (!focusWin)
|
||||
focusWin = m_richTextCtrl;
|
||||
if (focusWin && focusWin->GetEventHandler()->ProcessEvent(event))
|
||||
{
|
||||
//s_command = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue