I  am new to Win32::GUI.
I would like to open a simple, plain, main window, with only label objects on it, let say, and intercept a mouse click anywhere on the client area, so that, depending on where the click happens (Win32::GUI::GetCursorPos()), different actions can be taken.
It doesn't seem the mouse click event is handled by the main window. True?

As a default, no mouse events are sent to the window - to enable this feature, use the "-interactive" option.

The only solution I can see up to now is to add an 'enormous' button that covers the entire area, let's call it BigBut , then add the labels and define a sub called BigBut_Click() which calls to Win32::GUI::GetCursorPos() and Win32::GUI::Redraw($main, 1).

Has any one any idea on how to achieve this scope in a less clumsy way?
Incidentally: what objects are clickable? More generally, how can I know which events are seen by which objects?
Thanks in advance for any answer.

The code below might be able to help.

Cheers,

jez.
-------------------------
use Win32::GUI;

# main Window
$Window = new Win32::GUI::Window (
   -title    => "Some Window",
   -pos     => [100, 100],
   -size    => [400, 400],
   -name     => "Window",
   -interactive => '1',
   -onMouseMove => \&MouseMove,
   -onMouseDown => \&MouseDown,
) or die "new Window";

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

sub MouseDown {
 my ($self,$x,$y)[EMAIL PROTECTED];
 print "click $x $y $b\n";
}

sub MouseMove {
 my ($self,$x,$y)[EMAIL PROTECTED];
 print "move $x $y \n";
}

sub Window_Terminate {
 return -1;
}


Reply via email to