[gtkmm] How to set_active() a RadioMenuItem?



I want to set_active() a RadioMenuItem, but I am constantly failing.
I tried
   (++menulist.begin())->set_active();
to set_active the second item, but it doesn`t work. Even a static_cast
like mentioned in <http://mail.gnome.org/archives/gtkmm-list/2003-October/msg00301.html>
doesn't work for me. Do you have any hints how to succeed?

Below you find a minimal example exhibiting the problem. 

Ciao
Andreas


#include <gtkmm.h>

int main(int argc, char* argv[])
{
    Gtk::Main kit(argc, argv);
    Gtk::Window window;
    Gtk::MenuBar menubar;
    Gtk::Menu menu;

    Gtk::Menu::MenuList& menulist = menubar.items();
    menulist.push_back(Gtk::Menu_Helpers::MenuElem("foobar", menu));

    Gtk::RadioButtonGroup group;
    menulist = menu.items();
    menulist.push_back(Gtk::Menu_Helpers::RadioMenuElem(group, "foo"));
    menulist.push_back(Gtk::Menu_Helpers::RadioMenuElem(group, "bar"));
    menulist.push_back(Gtk::Menu_Helpers::RadioMenuElem(group, "baz"));
    (++menulist.begin())->set_active();
    
    window.add(menubar);
    window.show_all();
    kit.run(window);
}



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