Re: [API 2.4] Tooltip position



(question at the bottom)

Replying to my own question for people who might have the same problem in the future:

1) set a custom tooltip window "tipwin"
2) in bool on_query_tooltip(int x, int y, bool keyboard_tooltip, const Glib::RefPtr<Gtk::Tooltip>& tooltip) :
int rx, ry;
text_view.get_window(Gtk::TEXT_WINDOW_WIDGET)->get_root_coords(x, y, rx, ry); // this can work with the Gdk::Window of any widget
tipwin.move(rx, ry);
3) if you change the content of your tooltip, you might want to call tipwin.resize(1, 1) to fit the window to its content.

When setting a custom tooltip window, it seems that the argument tooltip is not added to the window and therefore is useless.

When not setting a custom tooltip window, the get_tooltip_window() method always return NULL, whereas the doc tells "This can be the GtkWindow created by default".
Is this a bug or a mistake in the doc ?

yann

On 16/11/12 17:50, Yann Leydier wrote:
Hullo,

I'm writing an application using a Gtk::TextView and I need to change
the TextView's tooltip depending on the character that is under the
mouse cursor. I did this with the query-tooltip signal and I am able to
change the label and icon as I wish.

However, when I move the mouse, the tooltip stays where it appeared. I
cannot find a way to make it follow the mouse cursor.

I tryed to set a custom tooltip window but Gtk::Window::move() takes
absolute coordinates, whereas signal_query_tooltip sends me coordinates
that are relative to the widget. Does anyone have an idea on how to do
that?

Thanks a lot,
yann
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


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