Gtk::Eventbox signal handling confusion while hover and click Gtk::Button

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


Gtk::Button *nButton;
Gtk::EventBox *nEventBox;
Gtk::Popover *nPopover;

bool onEnterButton(GdkEventCrossing *);
bool onExitButton(GdkEventCrossing *);
void onClick();


nEventBox->add_events(Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK);


bool ApplicationWindow::onEnterButton(GdkEventCrossing *event)

	if (event->mode !=GDK_CROSSING_NORMAL)
		return false;
	return true;


bool ApplicationWindow::onExitButton(GdkEventCrossing *event)
	if (event->mode !=GDK_CROSSING_NORMAL)
		return false;
	return true;

When cursor
Enter into the event box I can see the popover message
Leave the event box the popover messageremains 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.

If you just want to show a text, setting the tooltip on the button should be the easies solution to that?

1 Like

Tooltip worked fine.
When I place a Gtk Image as an icon for Gtk Button, tooltip doesn’t come up when used for button or image, don’t know want is happening.

Have you tried setting the tooltip for the gtkimage as well?

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.