Hi Steve,
The first method works but can not get the second to work for mouse move,
please see the code below, is it correct to catch the mouse location this way.
What I wanted is an event only fired when the mouse just got over the button
and another event fired when the mouse left the button, similar to
the onMouseOver and onMouseOut event so I can swap images on button when
it gets the mouve over and out.

#!perl -w
use Win32::GUI;
$MW = new Win32::GUI::Window(
    -title   => 'Mouse move test',
    -left    => 100,
    -top     => 100,
    -width   => 400,
    -height  => 250,
    -name    => 'MainWindow',
    -visible => 1,
);
$hello = $MW->AddButton(
    -text    => 'Hello, world', 
    -name    => 'Hello',
    -left    => 25,
    -top     => 25,
);

$Label = $MW->AddLabel(
       -text    => "x, y",
       -name    => "Label",
       -left    => 50,
       -top     => 80,
       -width   => 159,
       -height  => 20,
       -foreground    => 0,
  -visible=> 1,
      );

my $button = new Win32::GUI::Button(
 -parent=>$MW,
    -name => "MouseMove",
    -text => "Mouse Move",
    -left    => 25,
    -top     => 50,
    -onMouseMove => \&mousemovehandler,
    #-onMouseOver => \&mousemovehandler,
   # -onMouseOut => \&mousemovehandler,
 -visible=>1,
);
 
#$button->Hook(0x0200, \&mousemovehandler); # Is it 0x0200 or 0x2000?

sub mousemovehandler {
  shift;
  @x = @_;
  $x = "Coords: " . join ", ", @x;
  $Label->Text($x);
}

$MW->Show;
Win32::GUI::Dialog();

sub MainWindow_Terminate {
    $MW->PostQuitMessage(1);
}

sub Hello_Click {
    print STDOUT "Hello, world\n"; 
    $MW->PostQuitMessage(0);
}



  ----- Original Message ----- 
  From: Steve Pick 
  To: [EMAIL PROTECTED] ; Jez White ; 
perl-win32-gui-users@lists.sourceforge.net 
  Sent: Sunday, January 25, 2004 8:50 PM
  Subject: Re: [perl-win32-gui-users] Win32::FileOp Erro with Win32::GUI


  Hi,

  > is there an event to catch the mouse move over a button

  Yes, you can try onMouseMove from the NEM:

  my $button = new Win32::GUI::Button(
      -name => "Hello",
      -text => "bla bla",
      -onMouseMove => \&mousemovehandler
  );

  sub mousemovehandler {
      ...
  }

  If that doesn't work, you can hook the MouseMove event using the Hook Event 
Model:

  $button->Hook(0x0200, \&mousemovehandler);

  Steve

    ----- Original Message ----- 
    From: [EMAIL PROTECTED] 
    To: Jez White ; Steve Pick ; perl-win32-gui-users@lists.sourceforge.net 
    Sent: Sunday, January 25, 2004 12:46 PM
    Subject: Re: [perl-win32-gui-users] Win32::FileOp Erro with Win32::GUI


    I solved the problem temp. by using the files dialogs from Win32::GUI
    instead of using Win32::FileOp

    The main issue is you keep updating either Perl or perl2exe or 
    the thousands of modules, once you finsh the current beta version
    you get another beta and you may need to pay for ups...

    Thanks for help

    One last thing on my mind now, Is there an event to catch the mouse
    move over a button. The reason I am thinking to use buttons instead
    of the static toolbars and swap images when the button get the mouse over
    and mouse out and active states. May be adding few functions to the tool 
bar would
    be more practically

    Ramy
      ----- Original 
      ----- Original Message ----- 
      From: Jez White 
      To: [EMAIL PROTECTED] ; Steve Pick ; 
perl-win32-gui-users@lists.sourceforge.net 
      Sent: Sunday, January 25, 2004 2:23 PM
      Subject: Re: [perl-win32-gui-users] Win32::FileOp Erro with Win32::GUI


      Hummm. The perl2exe version looks fine - if the error is only happening 
with the exe, and you can't reproduce it using the activestate build, then the 
best bet is to get in touch with perl2exe support.

      As for the 'x' issue - I assume the window is called "Main" and you are 
returning the correct value?

      jez.


        ----- Original Message ----- 
        From: [EMAIL PROTECTED] 
        To: Jez White ; Steve Pick ; perl-win32-gui-users@lists.sourceforge.net 
        Sent: Sunday, January 25, 2004 12:03 PM
        Subject: Re: [perl-win32-gui-users] Win32::FileOp Erro with Win32::GUI


        Perl 2exe info below.

        Yes the errors when I compile to exe and run it
        but the close "x" issue is always with perl script or compiled
        and I am using the terminate event Main_Terminate....

        ---------------------------------------

        Perl2Exe V8.00 Copyright (c) 1997-2004 IndigoSTAR Software
        Known platforms: Win32
        Target platform = Win32 5.008002
        $I = 
        $ENV{'PERL5LIB'} = 
        Found perl.exe at C:\Perl\bin
        LibList = C:\Perl\lib,C:\Perl\site\lib,.
        Registered to XXXXXXXXXXX ENT version
        Usage: perl2exe myscript.pl
        options:
          -small                    Generate smaller exe file (Pro version only)
          -tiny                     Generate even smaller exe file (Pro version 
only)
          -gui                      Generate a no-console executable (Pro 
version only)

          -o=output_filename        Output file name
          -I=directory              Specify @INC directory (multiple 
directories can be
                                      separated by ; or : characters)

          -platform=Win32           Generate code for Win32 (default)
        ---------------------------------------

          ----- Original Message ----- 
          From: Jez White 
          To: [EMAIL PROTECTED] ; Steve Pick ; 
perl-win32-gui-users@lists.sourceforge.net 
          Sent: Sunday, January 25, 2004 1:55 PM
          Subject: Re: [perl-win32-gui-users] Win32::FileOp Erro with Win32::GUI


          Hi,

          The latest version of perl2exe was on the 31 Dec 2003 - beta support 
for 5.8.2 - if you haven't got this version, then you should upgrade. Is your 
problem only with the exe?

          The window close - are you using the terminate event?

          Cheers,

          jez.

Reply via email to