[Gtk-sharp-list] Re: Menu Position

Eric Butler eric@extremeboredom.net
Thu May 12 06:24:44 EDT 2005


The issue appears to be that you need to ShowAll() before Popup(). I've
updated the wiki page.


Please let me know that this worked for you.


Milen Dzhumerov wrote:
> Hi all,
> I've been having trouble positioning some popup menus. What I do is
> basically put an icon in the system tray, put it in an event box and
> catch right click. On right click I show a popup menu. When the
> (gnome/kde/fd.o compliant) panel is on top, everything works perfectly,
> but when it's on the bottom of the screen, it just displays an arrow to
> scroll and the actual menu items are hidden behind it, so it's unusable.
> I was told to pass a Gtk.MenuPositionFunc(Menu
> <http://www.go-mono.com/docs/monodoc.ashx?link=T%3aGtk.Menu> menu,out
> int <http://www.go-mono.com/docs/monodoc.ashx?link=T%3aSystem.Int32> x,
> out int <http://www.go-mono.com/docs/monodoc.ashx?link=T%3aSystem.Int32>
> y, bool
> <http://www.go-mono.com/docs/monodoc.ashx?link=T%3aSystem.Boolean>
> push_in) to Gtk.Menu.Popup(Widget
> <http://www.go-mono.com/docs/monodoc.ashx?link=T%3aGtk.Widget>, Widget
> <http://www.go-mono.com/docs/monodoc.ashx?link=T%3aGtk.Widget>,
> MenuPositionFunc
> <http://www.go-mono.com/docs/monodoc.ashx?link=T%3aGtk.MenuPositionFunc>,
> System.IntPtr
> <http://www.go-mono.com/docs/monodoc.ashx?link=T%3aSystem.IntPtr>, uint
> <http://www.go-mono.com/docs/monodoc.ashx?link=T%3aSystem.UInt32>, uint
> <http://www.go-mono.com/docs/monodoc.ashx?link=T%3aSystem.UInt32>). The
> only thing I can't work out is the algorithm of calculating the
> coordinates where I should pop up the menu. So I assume the first step
> would be to create a Gtk.Requisition and get menu.SizeRequest() so I
> know the requested size. But where do I go from there? I have spoken to
> some people on irc in #gtk+ but didn't get too much advice. I would
> *greatly* appreciate any help.
> Kind regards,
> gamehack
> PS. I'm doing it for this tutorial
> www.mono-project.com/GtkSharpNotificationIcon. If I get help eventually,
> I will document everything and write a mini howto and hopefully a
> systray_menu_position function so others can use it, because I'm finding
> it really hard to do this on my own with only API references. Again,
> thanks for any help.
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

More information about the Gtk-sharp-list mailing list