Has anyone noticed Systray clicks being sent twice to the script. For example, below is a code snippet. Whenever anyone clicks on "Open Window" for instance, the subroutine is called twice. We've had to implement a workaround (further below).

   # Create the popup menu
   $systray_menu = new Win32::GUI::Menu(
         "SystrayMenu Functions" => "SystrayMenu",
          "> Open Window"         => "_OpenWindow",
          "> Refresh Channels"    => "_RefreshChannels",
          "> Exit"                => "_FileExit"
   );

   # re-open the browser window.
   sub _OpenWindow_Click {
      &note("Received 'Open Window' request from Systray.");
      &open_url( $SETTINGS->{urls}->{channels_home} );
   }

The work around is rather simple, of course:

   # re-open the browser window.
   sub _OpenWindow_Click {

      &note("Received 'Open Window' request from Systray.");

      unless ( $already_called ) {

         # do the dirty deed.
         &open_url( $SETTINGS->{urls}->{channels_home} );

         # for some reason, we get two clicks every
         # time someone clicks a menu item. we check
         # for this here.
         $already_called = 1;
      }

      else { $already_called = 0; }
   }


Morbus Iff
.sig on other machine.
http://www.disobey.com/
http://www.gamegrene.com/


Reply via email to