[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtkmm
Subject:    Popup menu from Glade/Gtk::Builder with accelerators
From:       "Johan Winge" <johan.winge () telia ! com>
Date:       2013-04-30 15:23:17
Message-ID: op.wwc003lqj9sw9k () mail1 ! telia ! com
[Download RAW message or body]

Hello!

I have succesfully created my GUI, including menu bar and popup menu with  
Glade.

There are options in Glade (I'm using the plugin in Anjuta, if it matters)  
for specifying handlers for signals, but I haven't got that to work -- I  
suppose those options are only for C and plain Gtk? No problems, I connect  
handlers to the relevant signals in code:

    builder->get_widget("menuitemPopupTest", menuitemPopupTest);
    menuitemPopupTest->signal_activate().connect(
       sigc::mem_fun(*this, &MenuTest::on_menuPopupTest_activate));

In Glade I can also specify accelerators for menu items. They work  
excellently out of the box, but only for the menu items in the menu bar.  
In the popup menues, the key combination I specified ("Ctrl+P") show up  
correctly, but nothing happens when I press those keys.

I'm pretty sure I have to do something with an AccelGroup, judging from

https://developer.gnome.org/gtkmm-tutorial/3.4/sec-menus-examples.html.en

But the examples found there use Gtk::UIManager, and it is not at all  
clear to me how that relates to Gtk::Builder. Clearly, when using  
Gtk::Builder, there is a lot of magic taking place behind the scenes,  
seeing that I got the main menu working with accelerators without having  
to write any code at all. What is the cleanest way to let my popup menu be  
accelerated as well?

For what it is worth, I have prepared a minimal testcase, demonstrating  
what I have done so far:

http://alatius.dyndns.org/popup-menu-test.tar.gz

Thanks in advance!
-- Johan Winge
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic