Mark Heckmann
Mark Heckmann

Reputation: 11441

GTK: display a tooltip for a gtkButton in a gtkFixed container with gtkImage as background

I want to position a gtkButton on top of a gtkImage. I do this putting both inside a gtkFixed container. The problem now is that the button's tooltip is not shown anymore, when there is an image in the background. Without the image it works fine. How can I get the tooltip to be shown?

I am an R programmer so the below code is R-Gtk binding style, but should still convey the idea:

library(RGtk2)
w = gtkWindow() 
image = gtkImage(file="tmp_1.png")
btn = gtkButton("Test")
gtkWidgetSetTooltipText(btn, "test")
fx = gtkFixed()
gtkFixedPut(fx, image, 10, 10)   
gtkFixedPut(fx, btn, 10,10)
gtkContainerAdd(w, fx)
gtkWidgetShowAll(w)   

Any ideas? TIA.

Upvotes: 0

Views: 458

Answers (1)

erick2red
erick2red

Reputation: 1310

You should use GtkOverlay widget. You add your GtkImage widget as main child of the overlay and the button with gtk_overlay_add_overlay.

That should work, and that's the preferred way of doing it.

Upvotes: 1

Related Questions