I have this problem that I cannot sort out right now. I have three wxSTC under three different panels and I switch extensively between them. I want to be able to use shortcut (Ctrl+C/X/V). However, regadless of which STC have the focus, the first STC handles the event.
Here is an example if the above explanations aren't enough. Let say STCs are s1, s2 and s2.
- If focus is with s1 Ctrl+C copies selected text from s1 - Good
- move cursor to s2 and do Ctr+C, it copies selection from s1 - Bad
- move cursor to s3 and do Ctr+C, it copies selection from s1 - Bad
Is there a way to bind shortcurts to focused wxSTC without going thru handling events? wxTextCtrl seems to work just fine and effortlessly. I expected wxSTC to follow the same suit.
TIA
Multiple wxStyledTextCtrl and shortcut handling
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Multiple wxStyledTextCtrl and shortcut handling
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Re: Multiple wxStyledTextCtrl and shortcut handling
Can you build a small sample with only two wxSTC side-by-side and check if it happens there, too?
Use the source, Luke!
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Re: Multiple wxStyledTextCtrl and shortcut handling
I didn't thought of this. Let me test that!doublemax wrote:Can you build a small sample with only two wxSTC side-by-side and check if it happens there, too?
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Re: Multiple wxStyledTextCtrl and shortcut handling
So I tested with sample the scenario is the same.
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.
I'm not sure if that is the expected behavior or I just found a prize bug!
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.
I'm not sure if that is the expected behavior or I just found a prize bug!
Code: Select all
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"
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Re: Multiple wxStyledTextCtrl and shortcut handling
I haven't tested it myself yet, but this smells like a bug in wxSTC.
Use the source, Luke!
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Re: Multiple wxStyledTextCtrl and shortcut handling
I will file a bug report for futher followupdoublemax wrote:I haven't tested it myself yet, but this smells like a bug in wxSTC.
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Re: Multiple wxStyledTextCtrl and shortcut handling
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?