Re: [gtk-list] Re: binding accelerators to hidden widgets



On Tue, 22 Feb 2000, Tim Janik wrote:

> On Mon, 21 Feb 2000, Vlad Harchev wrote:
> 
> > 
> >  Hi,
> > 
> >  In my application, I found binding accelerators to hidden widgets very useful
> >  (for example, creating a hidden button with accelerator for "clicked" and 
> >  binding signal handler to it to do complex tasks such as switching to
> >  predefined notebook page). But I want to know whether it's legal to do so:
> > 
> >  I want to know whether gtk developers think that handling accelerators
> >  by hidden widgets is a correct thing (or not - whether such nice feature will
> >  be removed sometime in the future since it's considered as a bug). But I
> >  expect that it's intended behaviour and that it won't change.
> 
> hm, this is a two folded issue. i must admit, i haven't yet spent thoughts
> on this issue. while it's definitely clear that we don't want accelerators
> to function for insensitive widgets, there may be cases like programmers
> binding 'Y' (or something else) to some "Yes" button in a dialog, but on
> occasions only showing that dialog with the "Yes" button hidden.
> probably assuming that accelerators will not work for hidden widgets.
> for such code, we should probably prohibit accelerator activation for hidden
> widgets...
> 
> in any case, what you are doing there sounds like real overkill, why can't
> you catch the keys you are interested in with a toplevel's key_press_event
> signal handler, and call your code from there?

   Catching key_press_event complicates code unnecessary. With hidden buttons
approach, 
 * it's possible to turn off such accelerators by making hidden button
	nonsensitive,
 * It's possible to create such hidden buttons with glade and, iff libglade
        is used, let users to change accelerators by modifying .glade file
	used for constructing gui.
 * it's possible to attach several handlers, block them - ie it's
	possible everything possible for widgets.
	
 Another solution could be creating zero-sized buttons (and placing them in
zero-sized containers) or some other zero-sized widgets. But this can be
tricky.	

> > 
> >  Best regards,
> >   -Vlad
> > 
> 
> ---
> ciaoTJ
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> 

 Best regards,
  -Vlad



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