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 controls must 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 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

Reply via email to