Obtaining coordinates of a widget
- From: Daniel Haude <dhaude physnet uni-hamburg de>
- To: gtk-app-devel-list gnome org
- Subject: Obtaining coordinates of a widget
- Date: Wed, 19 Mar 2003 11:48:10 +0100 (CET)
Hello all,
I'd like to place a largish explanatory popup window next to a
button as soon as the mouse pointer moves over it (sort of like a
tool tip, only immediately and at a well-defined position). My
problem is to get the proper coordinates of the button widget in
order to move the popup window to the appropriate place with
gtk_window_move.
What I've been trying to do is:
static void on_b_thumbnail_enter (GtkButton * button, gpointer
user_data)
{
int x, y;
if (!popup) {
popup = create_wInfo();
}
gdk_window_get_root_origin(wBrowser->window, &x, &y);
x += (GTK_WIDGET(button)->allocation.x
- GTK_WIDGET(popup)->allocation.width);
y += GTK_WIDGET(button)->allocation.y;
gtk_window_move(GTK_WINDOW(popup), x, y);
gtk_widget_show(popup);
(void) user_data;
}
but the popup window gets shown at all sorts of weird offsets,
especially since the button widget is placed inside a scrolled
window. All I need to know is where the button is at the time the
mouse pointer enters, but I can't see how. Do I have to dig
through all the nested container widgets to finally arrive at
the position of the button? Any hints?
--Daniel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]