[ wxwindows-Patches-1804110 ] Dynamically adjust accelerators from menus

SourceForge.net noreply at sourceforge.net
Mon Oct 1 14:30:14 PDT 2007


Patches item #1804110, was opened at 2007-09-28 12:50
Message generated for change (Comment added) made by arst
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1804110&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: GTK specific
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: arst (arst)
Assigned to: Nobody/Anonymous (nobody)
Summary: Dynamically adjust accelerators from menus

Initial Comment:
In GTK, accelerators were only added to a wxWindow, never removed. 

If first a menu with say Ctrl-P in it was inserted into the wxMenuBar and then later removed, Ctrl-P would still remain bound to the now removed menu. 

As a result, keyboard events for Ctrl-P would remain blocked, also after removing the menu.


The patch fixes this, making sure menus can be dynamically inserted and removed for a main window, and the keyboard accelerators will be updated accordingly.

The issue was to make sure gtk_window_remove_accel_group() was called when removing a menu.

Sidenote:
There was very little to do to enable this. I was wodering if it had been there before and for some obscured reason removed?

Regards
// ATS.

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

>Comment By: arst (arst)
Date: 2007-10-01 23:30

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

One more issue corrected in updated patch:

In sub-menu destruction: It is important to free the GTK menu widget
before
we free all its sub-menus items (deleted in WX_CLEAR_LIST).

The problem would show up as GTK warnings when destroying a menu that
fulfilled:
1 - Having submenus with accelerators
2 - Inserted and later removed from a wxMenuBar.

If done in the order before this patch, the GTK widget would contain
rferences to accelerator in child items that were just destroyed.

A tricky bug. 

Regards
// ATS.
File Added: menu_accel_update.p2

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

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




More information about the wx-dev mailing list