I want to display information about the Button as soon as the pointer hovers or enters the area inside the Button
Looked at this post Trigger checkbutton hover event from another widget
Tried replicated it
*.hpp
Gtk::Button *nButton;
Gtk::EventBox *nEventBox;
Gtk::Popover *nPopover;
bool onEnterButton(GdkEventCrossing *);
bool onExitButton(GdkEventCrossing *);
void onClick();
*.cpp
builder->get_widget("nEventBox",nEventBox);
nEventBox->add_events(Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK);
builder->get_widget("nButton",nButton);
builder->get_widget("nPopover",nPopover);
nPopover->set_relative_to(*nButton);
nEventBox->signal_enter_notify_event().connect(sigc::mem_fun(*this,&ApplicationWindow::onEnterButton));
nEventBox->signal_leave_notify_event().connect(sigc::mem_fun(*this,&ApplicationWindow::onExitButton));
nButton->signal_clicked().connect(sigc::mem_fun(*this,&ApplicationWindow::onClick));
bool ApplicationWindow::onEnterButton(GdkEventCrossing *event)
{
if (event->mode !=GDK_CROSSING_NORMAL)
{
return false;
}
nPopover->popup();
return true;
}
bool ApplicationWindow::onExitButton(GdkEventCrossing *event)
{
if (event->mode !=GDK_CROSSING_NORMAL)
{
return false;
}
nPopover->popdown();
return true;
}
When cursor
Enter into the event box I can see the popover message
Leave the event box the popover message
remains doesn’t disappear
Only once I click inside the event box after entering it does the popover message
disappear.
What am I doing wrong?
Please guide.