> David Hiltz wrote:
> > > > 2) How do I enable a button that was created with the option ;-disabled
> > > > => 1; ?
> > 
> >     You mean through GB?
> > 
> 
> No, that's a general Win32::GUI question. I'm sure I've seen how to do
> it somewhere, but finding things in the docs are currently not the
> easiest thing in the world. Believe me, I _have_ tried.

  $Win->OBJECT_NAME->Change(-disabled => 0);

  You need to also update the text so the button is refreshed (see sample
  program below):

use Win32::GUI;

$Win = new Win32::GUI::Window(
      -left   => 341,
      -top    => 218,
      -width  => 226,
      -height => 163,
      -name   => "Win",
      -text   => "Window Title"
      );

$Win->Show();

$Win->AddButton(
       -text    => "TEST",
       -name    => "TEST",
       -left    => 131.5,
       -top     => 56,
       -width   => 50,
       -height  => 24,
       -disabled => 1,
      );

$Win->AddButton(
       -text    => "Enabled",
       -name    => "Enabled",
       -left    => 36.5,
       -top     => 43,
       -width   => 69,
       -height  => 24,
      );

$Win->AddButton(
       -text    => "Disabled",
       -name    => "Disabled",
       -left    => 36.5,
       -top     => 78,
       -width   => 69,
       -height  => 24,
      );

Win32::GUI::Dialog();

sub Win_Terminate {
   return -1;
}


Win32::GUI::Dialog();

sub Win_Terminate {
   return -1;
}

sub Enabled_Click {
   $Win->TEST->Change(-disabled => 0);
   $Win->TEST->Text($Win->TEST->Text);
}

sub Disabled_Click {
   $Win->TEST->Change(-disabled => 1);
   $Win->TEST->Text($Win->TEST->Text);
}

Reply via email to