home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Editores / Perl5 / perl / lib / site / auto / Tk / FocusOK.al < prev    next >
Encoding:
Text File  |  1997-08-10  |  607 b   |  30 lines

  1. # NOTE: Derived from blib\lib\Tk.pm.  Changes made here will be lost.
  2. package Tk;
  3.  
  4. sub FocusOK
  5. {
  6.  my $w = shift;
  7.  my $value;
  8.  catch { $value = $w->cget('-takefocus') };
  9.  if (!$@ && defined($value))
  10.   {
  11.    return 0 if ($value eq '0');
  12.    return 1 if ($value eq '1');
  13.    $value = $w->$value();
  14.    return $value if (defined $value);
  15.   }
  16.  if (!$w->viewable)
  17.   {
  18.    return 0;
  19.   }
  20.  catch { $value = $w->cget('-state') } ;
  21.  if (!$@ && defined($value) && $value eq "disabled")
  22.   {
  23.    return 0;
  24.   }
  25.  $value = grep(/Key|Focus/,$w->Tk::bind(),$w->Tk::bind(ref($w)));
  26.  return $value;
  27. }
  28.  
  29. 1;
  30.