[wx-dev] [ wxwindows-Bugs-1905777 ] Defining default accelerators for wxRichTextCtrl

SourceForge.net noreply at sourceforge.net
Sat May 3 13:19:15 PDT 2008


Bugs item #1905777, was opened at 2008-03-02 17:43
Message generated for change (Settings changed) made by juliansmart
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1905777&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: RichTextCtrl
Group: Must fix
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Andrej Sinicyn (andrej4000)
Assigned to: Julian Smart (juliansmart)
Summary: Defining default accelerators for wxRichTextCtrl

Initial Comment:
wxMSW has currently a big shortcoming because of Windows design compared to other ports like wxGTK.
On wxMSW there aren't defined any accelerators for default menu commands like Cut (Ctrl+X), Copy (Ctrl+C) and Paste (Ctrl+V). To use Ctrl+C with a wxRichEditCtrl on wxMSW I would have to write a menu with defined accelerator. Out of the box I can't copy and paste in a simple program.

A possible solution would be handling of such strings via locale/msw where a re-definition with accelerator key could be done. For example
-----
msgid "&Copy"
msgstr "&Copy\tCtrl+C"
-----

This would rise the usability of wxWidgets and ease programming.

----------------------------------------------------------------------

>Comment By: Julian Smart (juliansmart)
Date: 2008-05-03 20:19

Message:
Logged In: YES 
user_id=59495
Originator: NO

Done, thanks.

----------------------------------------------------------------------

Comment By: Andrej Sinicyn (andrej4000)
Date: 2008-03-16 15:39

Message:
Logged In: YES 
user_id=508463
Originator: YES

I found the true cause of the problem. The rich text control doesn't have
any default accelerators resulting in no cut/copy/paste.

Something like this should happen when the control is initialized:

--------
wxAcceleratorEntry entry, entries[4];
entries[0].Set(wxACCEL_CTRL, (int) 'A', wxID_SELECTALL);
entry = wxGetStockAccelerator(wxID_CUT);
entries[1].Set(m_AccelCopy.GetFlags(), m_AccelCopy.GetKeyCode(),
m_AccelCopy.GetCommand());
entry = wxGetStockAccelerator(wxID_COPY);
entries[2].Set(m_AccelCopy.GetFlags(), m_AccelCopy.GetKeyCode(),
m_AccelCopy.GetCommand());
entry = wxGetStockAccelerator(wxID_PASTE);
entries[3].Set(m_AccelCopy.GetFlags(), m_AccelCopy.GetKeyCode(),
m_AccelCopy.GetCommand());
wxAcceleratorTable accel(4, entries);
RichTextCtrl_Chat->SetAcceleratorTable(accel);
-------

This is IMHO very important to be in the original wxWidgets code and not
being done by user's application.

----------------------------------------------------------------------

Comment By: Andrej Sinicyn (andrej4000)
Date: 2008-03-11 09:38

Message:
Logged In: YES 
user_id=508463
Originator: YES

This patch disables the Cut/Copy/Paste menu items and voilà,
Cut/Copy/Paste doesn't work any more, although the rich text control has a
context menu, where Cut/Copy/Paste are defined. With wxGTK even in the
context menu the accelerators are shown, although they don't work.

----------------------------------------------------------------------

Comment By: Andrej Sinicyn (andrej4000)
Date: 2008-03-11 09:33

Message:
Logged In: YES 
user_id=508463
Originator: YES

File Added: no-cutcopypaste.diff

----------------------------------------------------------------------

Comment By: Vadim Zeitlin (vadz)
Date: 2008-03-03 15:25

Message:
Logged In: YES 
user_id=71618
Originator: NO

If they don't work, this would be a bug but then we need a way to
reproduce it. Ideally in the text sample (which has a lot of text controls
with all possible styles...) or in a minimal one. Could you please provide
a patch and instructions for reproducing the bug?

Thanks!

----------------------------------------------------------------------

Comment By: Andrej Sinicyn (andrej4000)
Date: 2008-03-03 11:51

Message:
Logged In: YES 
user_id=508463
Originator: YES

Well, they do not work for me.
I could upload an example project, where Ctrl+C/V/X do NOT work for me on
wxMSW.

----------------------------------------------------------------------

Comment By: Vadim Zeitlin (vadz)
Date: 2008-03-02 21:37

Message:
Logged In: YES 
user_id=71618
Originator: NO

Sorry, I don't understand what do you mean here. Certainly Ctrl+C/V/X do
work in wxTextCtrl and any other control which handles them (like
wxRichTextCtrl), there is no need for a menu item for this. So what exactly
doesn't work?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1905777&group_id=9863


More information about the wx-dev mailing list