Re: TrayIcon on Win32 Entry point error

zentara wrote:
On Wed, 29 Oct 2008 13:04:56 -0400
zentara <zentara1 sbcglobal net> wrote:

Would you happen to know how to pop the menu at an offset from the mouse position?


Never mind, I found it by experimenting.

my ($x, $y, $push_in) = Gtk2::StatusIcon::position_menu($menu, $statusicon); # print "$x, $y, $push_in\n"; $menu->popup( undef, undef, sub{return ($x,$y,0)} , undef, 0, 0 );
Try passing a reference to Gtk2::StatusIcon::position_menu directly as the function that calculates the position. Here's an example that works fine for me.


use strict;
use warnings;

use Glib qw(TRUE FALSE);
use Gtk2 '-init';

exit main();

sub main {

   # Create a system tray icon
   my $tray = Gtk2::StatusIcon->new_from_stock('gtk-color-picker');
# Build the tray's popup menu
   my $tray_menu = Gtk2::Menu->new();
# Add a close menu item
   my $menu_item_close = Gtk2::ImageMenuItem->new_from_stock('gtk-close');
   $menu_item_close->signal_connect(activate => sub {

   # Show the menu when there's a right click
   $tray->signal_connect('popup-menu' => sub {
           my ($tray, $button, $time) = @_;
   # Start the main loop
return 0;


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