Re: custom accel_key for a menu item



В Чтв, 05/04/2007 в 16:35 +0200, gallows пишет:
> Hi!
> I've a Gtk::MenuItem, how can I apply to it a custom accelerator key?
> I've tried this:
> 
> menu_item.set_accel_key(Gtk::AccelKey('z', Gdk::CONTROL_MASK));
> 
> But set_accel_key() is protected!
> What is the right way to do this?


You may specify accelerator on menu element creation.
Actually, it is good to use Gtk::Action to create menu or tool items.
So, you may add accelerator as

Gtk::ActionGroup::object_ref->add( action_object, Gtk::AccelKey( ... ), sigc::slot_object );

Either later use Gtk::Widget::add_accelerator() method.

-andrew





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