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

  1. # NOTE: Derived from blib\lib\Tk\Frame.pm.  Changes made here will be lost.
  2. package Tk::Frame;
  3.  
  4. sub labelPack
  5. {
  6.  my ($cw,$val) = @_;
  7.  my $w = $cw->Subwidget('label');
  8.  my @result = ();
  9.  if (@_ > 1)
  10.   {
  11.    if (defined($w) && !defined($val))
  12.     {
  13.      $w->packForget;
  14.     }
  15.    elsif (defined($val) && !defined ($w))
  16.     {
  17.      require Tk::Label;
  18.      $w = Tk::Label->new($cw,-textvariable => $cw->labelVariable);
  19.      $cw->Advertise('label' => $w); 
  20.      $cw->ConfigDelegate('label',qw(text textvariable));
  21.     }
  22.    if (defined($val) && defined($w))
  23.     {
  24.      my %pack = @$val;
  25.      unless (exists $pack{-side})
  26.       {
  27.        $pack{-side} = 'top' unless (exists $pack{-side});
  28.       }
  29.      unless (exists $pack{-fill})
  30.       {
  31.        $pack{-fill} = 'x' if ($pack{-side} =~ /(top|bottom)/);
  32.        $pack{-fill} = 'y' if ($pack{-side} =~ /(left|right)/);
  33.       }
  34.      unless (exists($pack{'-before'}) || exists($pack{'-after'}))
  35.       {
  36.        my $before = ($cw->packSlaves)[0];
  37.        $pack{'-before'} = $before if (defined $before);
  38.       }
  39.      $w->pack(%pack);
  40.     }
  41.   }
  42.  @result = $w->packInfo if (defined $w);
  43.  return (wantarray) ? @result : \@result;
  44. }
  45.  
  46. 1;
  47.