wxWidgets / wxWidgets

Cross-Platform C++ GUI Library
https://www.wxwidgets.org/
6.17k stars 1.77k forks source link

Multiple wxStyledTextCtrl shortcut mis-handling #17968

Open wxtrac opened 7 years ago

wxtrac commented 7 years ago

Issue migrated from trac ticket # 17968

component: wxStyledText | priority: normal

2017-10-04 19:27:34: evstevemd (Stefano) created the issue


I have observed that when I have mutiple wxStyledTextCtrl in different places only one of them processed shortcuts and the rest does not get a chance even when they have a focus.

Here is the scenario:

Let say STCs are s1, s2 and s2.

Here is git diff for STC sample to test.

diff --git a/samples/stc/stctest.cpp b/samples/stc/stctest.cpp
index 34ab8a8..52fb80b 100644
--- a/samples/stc/stctest.cpp
+++ b/samples/stc/stctest.cpp
@@ -824,9 +824,11 @@ public:
     MinimalEditorFrame() : wxFrame(NULL, wxID_ANY, _("Minimal Editor"))
     {
         MinimalEditor* editor = new MinimalEditor(this);
+        MinimalEditor* editor2 = new MinimalEditor(this);
         editor->SetFont(wxSystemSettings::GetFont(wxSYS_ANSI_FIXED_FONT));
         wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
         sizer->Add(editor, 1, wxEXPAND);
+        sizer->Add(editor2, 1, wxEXPAND);
         SetSizer(sizer);
         editor->SetText(
            "<xml>\n"

Just apply the patch below and then select text on an open editor. Go to menu (Window->Minima Editor) and it will open two more editors in a dialog. Try select text in any of the two and do Ctrl+X and see that it cuts text from first editor not the current.

wxtrac commented 7 years ago

2017-10-08 11:19:41: @a-wi changed status from new to infoneeded_new

2017-10-08 11:19:41: @a-wi commented

Under which platform have you observed this issue? I briefly tested wxSTC under wxMSW and haven't seen any strange behaviour with clipboard.

wxtrac commented 7 years ago

2017-11-08 20:05:55: evstevemd (Stefano) changed status from infoneeded_new to new

2017-11-08 20:05:55: evstevemd (Stefano) commented

Replying to [comment:1 awi]:

Under which platform have you observed this issue? I briefly tested wxSTC under wxMSW and haven't seen any strange behaviour with clipboard.

Hi sorry for late reply. I tested only under OSX. Currently I don't have access to Windows nor Linux. When I do I will test with same app to see if they are affected too