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

  1. # NOTE: Derived from blib\lib\Tk\Widget.pm.  Changes made here will be lost.
  2. package Tk::Widget;
  3.  
  4. sub Busy
  5. {
  6.  my ($w,%args) = @_;
  7.  return unless $w->viewable;
  8.  $args{'-cursor'} = 'watch' unless (exists $args{'-cursor'});
  9.  unless (exists $w->{'Busy'})
  10.   {
  11.    my %old = ();           
  12.    my $key;                
  13.    my @tags = $w->bindtags;
  14.    foreach $key (keys %args)
  15.     {
  16.      $old{$key} = $w->Tk::cget($key);
  17.     }
  18.    $old{'bindtags'} = \@tags;
  19.    $old{'grab'}     = $w->grabSave;
  20.    unless ($w->Tk::bind('Busy'))
  21.     {                     
  22.      $w->Tk::bind('Busy','<KeyPress>','bell');
  23.      $w->Tk::bind('Busy','<ButtonPress>','bell');
  24.     }                     
  25.    $w->bindtags(['Busy']);
  26.    $w->{'Busy'} = \%old;
  27.   }
  28.  $w->Tk::configure(%args);
  29.  eval {local $SIG{'__DIE__'};  $w->grab };
  30.  $w->update;
  31. }
  32.  
  33. 1;
  34.