Re: TrayIcon on Win32 Entry point error



On Wed, 29 Oct 2008 18:45:58 +0100
Emmanuel Rodriguez <emmanuel rodriguez gmail com> wrote:

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?

Thanks,
zentara
    

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.

   # Show the menu when there's a right click
   $tray->signal_connect('popup-menu' => sub {
           my ($tray, $button, $time) = @_;
           $tray_menu->popup(
               undef,
               undef,
               \&Gtk2::StatusIcon::position_menu,
               $tray,
               $button,
               $time
           );
   });

Emmanuel

Thanks, that is probably the way it is supposed to work, but I setup
my binding slightly differently.

$statusicon->signal_connect( 'popup-menu', \&config_it );

So I had to do it the hard way. :-)
It's good to know both ways will work.

zentara

-- 
I'm not really a human, but I play one on earth.
http://zentara.net/Remember_How_Lucky_You_Are.html 



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