Re: How to disable a control without changing appearance
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 ornot 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-understoodWhat 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 thisworks:#!perl -wuse strict;use warnings;use Win32::GUI();# Constantssub 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
Re: How to disable a control without changing appearance
Ok. I found the constants in WINUSER.h. On 12/20/05, Chris Rogers [EMAIL PROTECTED] wrote: 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 ornot 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-understoodWhat 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 thisworks:#!perl -wuse strict;use warnings;use Win32::GUI();# Constantssub 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
Re: [aswin32] Re: How to disable a control without changing appearance
Chris Rogers wrote: Sorry, about the lack of information in my original post. I just assumed, this being a perl-win32 group that Win32::GUI was a given. I'll try to be more specific in the future. I tried $control-Enable(0) but the control still gets greyed out. I'm using activestate perl 5.8.7 and Win32::GUI 1.03 on win xp. Here's a brief example: #!c:\perl58\bin\wperl.exe -W use strict; use Win32::GUI; use Win32::API; our $mainform = Win32::GUI::Window-new( -name='main', -text='main', -width=800,-height=600, ) or die window creation failed: $!\n; our $test = $mainform-AddTextfield( -name='test', -text='test', -left=200,-top=200, -width=100,-height=20, ); $test-Enable(0); $mainform-Show(); Win32::GUI::Dialog; I also tried to set the onClick event to an empty sub which didn't work either our $test = $mainform-AddTextfield( -name='test', -text='test', -left=200,-top=200, -width=100,-height=20, -onClick=sub{}, ); On 12/18/05, *Robert May* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Lynn. Rickards wrote: Chris Rogers wrote: I'm looking for a way to disable a control (widget) without changing it's appearance. I would like to be able to do this for any type of control. Any help would be greatly appreciated. Thanks, Chris Tk? Win32? Either way, what comes to mind instead of disabling, is configuring/binding to an empty sub. For Win32::GUI use $control-Enable(0); Regards, Rob. OK, I'm no Win32::Gui expert, and by the way, Tk is part of the ASperl distro, while Win32::Gui isn't...but don't let's fight over which should be the default assumption in the list ;-) I had assumed you were looking to render a button-based widget inactive. Since it is a text widget that (in win32-gui) doesn't seem to respond to mouseclick events, we need to handle it differently. Since calling $textbox-Enable(); and $textbox-Disable(); changes the colors, you would want to fix the colors. I find that adding: -background = [255, 255, 255], ...to AddTextfield() will hold the background white in both states. However, -foreground is overridden when the widget is disabled, and text is slightly grayed. I failed to find anything like Tk's $widget-configure() in the win32-gui docs - anyone? Half an answer, anyhow... HTH - Lynn. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: [aswin32] Re: How to disable a control without changing appearance
Point taken on the default assumption of what this list is about. Thanks for the tip on the background color. It appears that the changing appearance is handled directly by the OS when we send it a message to disable the control. It also appears that the two parts of the process WM_DISABLE and WM_PAINT are not easily seperated. Perhaps there is a better way to do this. The whole idea is to be able to use the mose to grab any control on a given Win32::GUI window and drag it toa new location. Sort of a gui designer. I know this has been done but I'll learn more by doing it again. I've worked out all the kinks except most that controlsmust be disabled in order to grab them with the mouse. Or at least this is the case using my code. It's probably broken. The thing is that if the objects are disabled, I can't really tell myself I've created a wysisyg window designer. Thanks, Chris On 12/19/05, Lynn. Rickards [EMAIL PROTECTED] wrote: Chris Rogers wrote: Sorry, about the lack of information in my original post.I just assumed, this being a perl-win32 group that Win32::GUI was a given. I'll try to be more specific in the future. I tried $control-Enable(0) but the control still gets greyed out.I'm using activestate perl 5.8.7 and Win32::GUI 1.03 on win xp.Here's a brief example: #!c:\perl58\bin\wperl.exe -W use strict; use Win32::GUI; use Win32::API; our $mainform = Win32::GUI::Window-new( -name='main', -text='main', -width=800,-height=600, ) or die window creation failed: $!\n; our $test = $mainform-AddTextfield( -name='test', -text='test', -left=200,-top=200, -width=100,-height=20,); $test-Enable(0); $mainform-Show(); Win32::GUI::Dialog; I also tried to set the onClick event to an empty sub which didn't work either our $test = $mainform-AddTextfield( -name='test', -text='test', -left=200,-top=200, -width=100,-height=20, ->); On 12/18/05, *Robert May* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Lynn. Rickards wrote: Chris Rogers wrote: I'm looking for a way to disable a control (widget) without changing it's appearance.I would like to be able to do this for any type of control.Any help would be greatly appreciated. Thanks, Chris Tk? Win32? Either way, what comes to mind instead of disabling, is configuring/binding to an empty sub. For Win32::GUI use $control-Enable(0); Regards, Rob.OK, I'm no Win32::Gui expert, and by the way, Tk is part of the ASperl distro, while Win32::Gui isn't...but don't let's fight over which shouldbe the default assumption in the list ;-)I had assumed you were looking to render a button-based widget inactive.Since it is a text widget that (in win32-gui) doesn't seem to respond to mouseclick events, we need to handle it differently.Since calling $textbox-Enable(); and $textbox-Disable(); changes thecolors, you would want to fix the colors. I find that adding: -background ="" [255, 255, 255], ...to AddTextfield() will hold the background white in both states.However, -foreground is overridden when the widget is disabled, and textis slightly grayed.I failed to find anything like Tk's $widget-configure() in the win32-gui docs - anyone?Half an answer, anyhow...HTH - Lynn. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: How to disable a control without changing appearance
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
Re: [aswin32] Re: How to disable a control without changing appearance
Lynn. Rickards wrote: Chris Rogers wrote: I'm looking for a way to disable a control (widget) without changing it's appearance. I would like to be able to do this for any type of control. Any help would be greatly appreciated. Thanks, Chris Tk? Win32? Either way, what comes to mind instead of disabling, is configuring/binding to an empty sub. For Win32::GUI use $control-Enable(0); Regards, Rob. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: [aswin32] Re: How to disable a control without changing appearance
Sorry, about the lack of information in my original post. I just assumed, this being a perl-win32 group that Win32::GUI wasa given. I'll try to be more specific in the future. I tried $control-Enable(0) but the control still gets greyed out. I'm using activestate perl 5.8.7 and Win32::GUI 1.03 on win xp. Here's a brief example: #!c:\perl58\bin\wperl.exe -Wuse strict;use Win32::GUI;use Win32::API; our $mainform = Win32::GUI::Window-new( -name='main', -text='main', -width=800,-height=600, ) or die window creation failed: $!\n; our $test = $mainform-AddTextfield( -name='test', -text='test', -left=200,-top=200, -width=100,-height=20, );$test-Enable(0);$mainform-Show();Win32::GUI::Dialog; I also tried to set the onClick event to an empty sub which didn't work either our $test = $mainform-AddTextfield( -name='test', -text='test', -left=200,-top=200, -width=100,-height=20, -> ); On 12/18/05, Robert May [EMAIL PROTECTED] wrote: Lynn. Rickards wrote: Chris Rogers wrote: I'm looking for a way to disable a control (widget) without changing it's appearance.I would like to be able to do this for any type of control.Any help would be greatly appreciated. Thanks, Chris Tk? Win32? Either way, what comes to mind instead of disabling, is configuring/binding to an empty sub.For Win32::GUI use$control-Enable(0);Regards,Rob.___Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.comTo unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
How to disable a control without changing appearance
I'm looking for a way to disable a control (widget) without changing it's appearance. I would like to be able to do this for any type of control. Any help would be greatly appreciated. Thanks, Chris ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: How to disable a control without changing appearance
Chris Rogers wrote: I'm looking for a way to disable a control (widget) without changing it's appearance. I would like to be able to do this for any type of control. Any help would be greatly appreciated. Thanks, Chris Tk? Win32? Either way, what comes to mind instead of disabling, is configuring/binding to an empty sub. HTH - Lynn. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs