Cool!!  I was unaware of the Hook method. 
 
Using what you showed me, I can do away with a lot of code that I used to track the mouse and decide whether or not it was currently over a control.  As well as the code I used to move the object around on the screen.  But when I use the hook method for the WM_NCHITTEST message, I can't respond to click events the way I would like. 
 
As I understand it now, I can set multiple Hooks for one message as well as different hooks for different messages.  I think I have found a pretty good list of messages and return values on msdn but I can't find the values for the constants. 
 
In all the docs I've looked at, I haven't found on that told me that WM_NCHITTEST = 132 or HTCAPTION = 2.  Can you tell me where to find the actual values for the constants?

 
Thanks,
Chris
 
On 12/20/05, May, Robert <[EMAIL PROTECTED]> wrote:
Chris Rogers wrote:

[snip]

> The whole idea is to be able to use the mouse to grab
> any control on a given Win32::GUI window and drag it
> to a new location.  Sort of a gui designer.

Apologies for my first response, I completely mis-understood
What you were trying to do.

Is this better?  Look at MSDN documentation for WM_NCHITTEST
and then ask here if you need an explanation of how/why this
works:

#!perl -w
use strict;
use warnings;

use Win32::GUI();

# Constants
sub WM_NCHITTEST() {132}
sub HTCAPTION()      {2}

my $mw = Win32::GUI::Window->new(
       -title => "Designer",
       -pos => [100,100],
       -size => [400,300],
);

$mw->AddTextfield(
       -size => [100,100],
       -multiline => 1,
       -text => 'Left mouse to drag',
)->Hook(
       WM_NCHITTEST,
       sub { $_[0]->Result(HTCAPTION); 0;}
);

$mw->Show();
Win32::GUI::Dialog();
exit(0);
__END__

Regards,
Rob.

=========================================================
This email message and any attachments thereto are intended only for use by the addressee(s) named above, and may contain legally privileged and/or confidential information. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the [EMAIL PROTECTED] and destroy the original message

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to