Re: Toolbar button accelerators

On Aug 9, 2004, at 2:15 PM, jjd wrote:

I have a window with a toolbar of several buttons. I want to make the
keyboard 'F1','F2','F3' to have the same effect as clicking these
buttons. How do I do this? I see in the examples how to connect the
accelerators to subs in the program, but is there a way to connect them
directly to the buttons? Or do I need to write a sub and within that
call the $button->clicked()

this is the purpose of the action-based toolbars and menus in gtk+ 2.4. you create an action object, hook the desired behavior to the action, and the connect the toolbars, menus, and accelerators to the actions.

if you can't use gtk+ 2.4, you can still employ similar techniques "by hand", but the drawback is that you have to do it by hand. basically, to make the keys have the same effect as clicking the buttons, you have the button callbacks and accelerator callbacks all call the same functions.

The door is locked. I tried to open it, but the lock is harder to pick than a broken nose.
  -- Sensei, on 'I, Ninja'

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