Re: Problems with underlined accelerator keys

On Sat, 28 Aug 1999, Damon Chaplin wrote:

> Hi,
> I've recently added support for underlined accelerator keys in Glade so
> that if you have a label with '_Hello' and an entry next to it, then
> pressing Alt + H will set the focus to the entry.
> However, there is a problem if you use something like a notebook, since
> you may have underlined accelerator keys on several pages and some of them
> may clash.
> The general problem is that you typically only want these sorts of
> accelerator keys to be active while the label or the target widget is visible.
> One solution may be to add another flag to GtkAccelFlags,
> GTK_ACCEL_ONLY_IF_VISIBLE. Then when looking up an accelerator, these entries
> are skipped if they are not currently visible.

accelerators are a too generic thing for this, e.g. there might be multiple
labels displaying a widget's accelerators or none. neither the accelerator
itself, nor the widget that the accelerator is installed for have any knowledge
of the widgets that display the accelerator bindings.

the only thing we could actually check would be the visibility of the widget
that the accelerator is installed on, *plus* the visibility of its anchestry.
but that will fail for a notebook anyways, since a notebook only unmaps its
pages and doesn't hide them. also a notbook page can just contain
only accellabels (e.g. for an accelerator configuration dialog) and not the
accelerated widgets itself, gtk really hasn't much of an idea when you want
those accelerators to be active and when not.
the correct aproach here is to group the accelerators together according to
the notebook pages and remove/add those groups to the main window with the
notebook page switches. we might want to add a more convenient interface in
1.3 that allowes for enabling and disabling of accelerator groups or
individual accelerators even.

> Damon


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]