How to show tooltip immediately on hover? [GTK3]

I’m writing an application where items in a list are represented by icons, and tooltips are used to inform the user about the names of the items. The only problem is the tooltips don’t show immediately when you hover over the items, you have to wait a bit of the tooltip to appear. Sometimes if you moved your mouse quickly, the tooltips don’t appear at all. This is undesirable as the user needs to be able to quickly see the names of the items.

The “gtk-tooltip-timeout” property has been deprecated since 3.10, so how do I make tooltips show faster?

You don’t.

If a tooltip is already showing, and you change the widget underneath the pointer, then the tooltip should be updated automatically, without requiring to trigger a timeout.

Showing the tooltip immediately would make the UI unusable.

I’m not changing the widget. I just want the tooltip to show right away when the cursor moves to the widget, instead of waiting for a bit after the cursor stops moving. Is there really no way to do this?

Do I have to implement my own tooltip, with say GtkPopover?

I think that the word “tooltip” is used for two very different functionalities, which is the cause for the misunderstanding.

The classic tooltip is a subsidiary aid to produce an additional help/hint for some users. In this case a short break is all right.

In your case, the tooltip is rather a vital part of the control element. This case is not covered by classic tooltips. (Apart from that, Mr. Bassi seems to have some aversion against tooltips in general.)

So, in this context, you need perhaps to code your own solution and consider it not as a classic tooltip but as something different. Probably, this difference could even have some visual impact.

What is the most convenient way to detect a cursor above a widget?

For this purpose, I use “enter-notify-event” and “leave-notify-event” signals. Whether this is a convenient approach, it depends… :slight_smile:

Yeah I gotta put my widget in an event box, set the event mask for its window and set callbacks…

Ok I had some trouble getting my popover to appear. For some reason gtk_widget_show didn’t work but gtk_popover_popup did.

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