Don't pass strings not containing accelerators to ParseAccel().

Check for the presence of accelerator part in the string passed to
wxAcceleratorEntry::Create() and don't call ParseAccel() at all if it's not
there. This avoids the spurious warnings about unrecognized accelerators when
creating menu items that don't have any accelerators at all.

Also update wxAcceleratorEntry::FromString() documentation to mention that
the new code should pass just the accelerator to this function and that it
only accepts full menu item labels for compatibility.

Closes #12770.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66379 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-12-15 11:18:42 +00:00
parent a67c2d4161
commit 6fc7a1ad1c
2 changed files with 20 additions and 6 deletions

View File

@@ -119,7 +119,10 @@ public:
ToString(), i.e. contain the accelerator itself only, or have the
format of a full menu item text with i.e. <code>Label TAB
Accelerator</code>. In the latter case, the part of the string
before the TAB is ignored.
before the TAB is ignored. Notice that the latter format is only
supported for the compatibility with the previous wxWidgets
versions and the new code should pass only the accelerator string
itself to this function.
@return @true if the given string correctly initialized this object
(i.e. if IsOk() returns true after this call)