Tooltips don't appear on menuitems made with UImanager.



What the title says. The tooltips don't appear on the menuitems even though they are provided in the Gtk::Action. I suppose I am missing something. Can you help me? Below is an example program that shows the behaviour I mention. The menuitem "OPEN" should have a tooltip "THIS IS A TOOLTIP.".

Example:

#include <gtkmm.h>

class ExampleWindow : public Gtk::Window
{
public:
  ExampleWindow();
  virtual ~ExampleWindow();

protected:

  Gtk::VBox m_Box;


  Glib::RefPtr<Gtk::UIManager> m_refUIManager;
  Glib::RefPtr<Gtk::ActionGroup> m_refActionGroup;
};

ExampleWindow::ExampleWindow()
{
  set_title("main menu example");
  set_default_size(200, 200);


  add(m_Box);

  m_refActionGroup = Gtk::ActionGroup::create();

  m_refActionGroup->add(Gtk::Action::create("FileMenu", "File"));
  m_refActionGroup->add(Gtk::Action::create("FileOpen", Gtk::Stock::OPEN, "OPEN", "THIS IS A TOOLTIP."));

  m_refUIManager = Gtk::UIManager::create();
  m_refUIManager->insert_action_group(m_refActionGroup);

  Glib::ustring ui_info =
        "<ui>"
        "  <menubar name='MenuBar'>"
        "    <menu action=''>"
        "      <menuitem action=''/>"
        "    </menu>"
        "  </menubar>"
        "</ui>";

  m_refUIManager->add_ui_from_string(ui_info);


  Gtk::Widget* menubar = m_refUIManager->get_widget("/MenuBar");
  m_Box.pack_start(*menubar, Gtk::PACK_SHRINK);


  show_all_children();
}

ExampleWindow::~ExampleWindow()
{
}

int main(int argc, char *argv[])
{
  Gtk::Main kit(argc, argv);

  ExampleWindow window;

  Gtk::Main::run(window);

  return 0;
}



Μείνετε συνδεδεμένοι με τους φίλους σας στο Zoo Κάντε κλικ εδώ!


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