From: Peter Eisengrein <Peter.Eisengrein@at...> - 2005-05-12 17:43:43
> 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?
> 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.
You're overthinking it. Here's one simple way: add a label that is the same
size as the window and make it respond to clicks via -notify=>1. Don't
forget to resize it if the window is resized.
my $Window = new Win32::GUI::Window (
-title => "Now whole Window is a Label",
-pos => [100, 100],
-size => [400, 400],
-name => "Window",
my $Label = $Window->AddLabel(
-name => "Label",
-pos => [0,0],
-size => [400,400],
-text => "",
-notify => 1,
my $Label2 = $Window->AddLabel(
-name => "Label2",
-pos => [10,10],
-text => "This is the second label on top of the first",
print "Got a click\n";
> My problem is now:
> Are they other mouse events that can be trapped this way?
> I tried onMouseClick, onMouseDoubleClick with no result;
> but onMouseRightDown had the desired effect...
I think you can use the following:
> Where could I have found references to these windows options (interactive,
> onMouseMove, ...)?
> The documentation that comes along with a ppm installation from L.Rocher's
> rep doesn't
> mention these options for example, neither does E.Bourgeois's tutorial at
> jeb.ca, the only
> documentation Source Forge points to.
> Are they other links for complete and updated reference manuals?
Unfortunately, the latest version of the module on sourceforge does not
contain the documentation. If you download the source you'll find a couple
of scripts in \Win32-GUI\docs if you run dodoc.pl and dohtml.pl they will
build all the documents.
Perhaps it would be a good idea to have a zip file on the sourceforge site
that contains all the doco?