Re: Menu popup problems
- From: Angelo Cano <acano systec com>
- To: gtk-app-devel-list gnome org
- Subject: Re: Menu popup problems
- Date: Sat, 23 Dec 2000 12:15:19 -0500
On Fri, Dec 22, 2000 at 10:36:44PM -0800, learfox furry ao net wrote:
How do I get the coordinates for a menu pop up callback function such that
the coordinates can align a menu with respect to another widget?
Basically I have a `find' button that needs to pop up a menu when pressed.
This menu needs to be positioned directly under the button widget.
My stumbling point is that I can't find a function that will return the
pointer coordinates respect to root and respect to the button widget.
Use GtkMenuPositionFunc you get coordinates of pointer with respect
to root. Then use gdk_window_get_origin() to get the button's GdkWindow
coordinates with respect to root.
I'd really appreciate any ideas or suggestions! :)
void menu_position_function (GtkMenu *menu,
gint *x,
gint *y,
gpointer data)
{
GtkWidget *button = GTK_WIDGET (data);
gint wx, wy;
gdk_window_get_origin (button->window, &wx, &wy);
*x = wx + button->allocation.width / 2;
*y = wy + button->allocation.height;
}
...
if (event->button == 3) {
gtk_menu_popup (GTK_MENU (popup_menu),
NULL,
NULL,
menu_position_function,
button_widget,
event->button,
event->time);
return TRUE;
}
...
--
Sincerely, ,"-_ \|/
-Capt. Taura M. , O=__ --X--
..__ ,_JNMNNEO=_ /|\
OMNOUMmnne. {OMMNNNEEEEOO=_
UOOOBIOOOEOMMn. 'LONMMMMNNEEEOOO=.__..,,..
UUOOEUUOOOOOOOObe '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
OOUUUIEEIOONNOIUbe. "7OMMMMNNNNNWWEEEEOOOOOO" "'.
EEBNNMMMNWNWWEEIMMNe. __ 7EMMMNNNNNWWWEEEEEEEOO. " .
NNMMMMWWWMMMWEINMMMNn "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._ .
http://furry.ao.net/~learfox/
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]