All the changes I made to the quoted document seem to have disappeared before I pressed send. Weird. Let's try again:

How come this doesn't work as described in the documentation?
The move_MouseDown sub never gets called, but the move_Click one does.

I believe you need to use subclassing to get the MouseDown event.

##########
use Win32::GUI;

# add this (see the docs for options)
$myClass = new Win32::GUI::Class(%options);

$main = new Win32::GUI::Window(
   -name => "Window",
   -pos => [ 100, 100 ],
   -size => [400, 200 ],
);

$move = $main->AddButton(
    class => $myClass. # add this
    -pos     => [100, 90],
    -size    => [200, 20],
    -text => "hello",
    -name => 'move',
);

$main->Show();

Win32::GUI::Dialog();

sub Window_Terminate {
 return -1;
}

sub move_MouseDown {
 print "MouseDown\n";
 return 0;
}

sub move_Click {
 print "MouseClick\n";
 return 0;
}
###########

I haven't actually tested this - it's all from memory, so let me know if it works.

_________________________________________________________________
MSN 8: Get 6 months for $9.95/month. http://join.msn.com/?page=dept/dialup


Reply via email to