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

Reply via email to