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

  1. # NOTE: Derived from ..\blib\lib\Tk\Web.pm.  Changes made here will be lost.
  2. package Tk::Web;
  3.  
  4. sub Open
  5. {
  6.  my ($w) = @_;
  7.  unless (exists $w->{'Open'})
  8.   {
  9.    my $t = $w->toplevel;
  10.    my $o = $w->toplevel->Toplevel(-popover => $w, -popanchor => 'n', -overanchor => 'n');
  11.    $o->withdraw;
  12.    $o->transient($t);
  13.    $o->protocol(WM_DELETE_WINDOW => [withdraw => $o]);
  14.    $w->{'Open'} = $o;
  15.    $o->{'url'}  = $w->url;
  16.    my $e = $o->LabEntry(-label => 'Location :',-labelPack => [ -side => 'left'],
  17.                 -textvariable => \$o->{'url'}, -width => length($o->{'url'}))->pack(-fill => 'x');
  18.    my $b = $o->Button(-text => 'Open', 
  19.                       -command =>  sub {  $o->withdraw ; $w->HREF('GET',$o->{'url'}) } 
  20.                      )->pack(-side => 'left',-anchor => 'w', -fill => 'x');
  21.    $e->bind('<Return>',[$b => 'invoke']); 
  22.    $o->Button(-text => 'Clear', -command => sub { $o->{'url'} = "" })->pack(-side => 'left',-anchor => 'c', -fill => 'x');
  23.    $o->Button(-text => 'Current', -command => sub { $o->{'url'} = $w->url })->pack(-side => 'left',-anchor => 'c', -fill => 'x');
  24.    $o->Button(-text => 'Cancel', -command => [ withdraw => $o ])->pack(-side => 'right',-anchor => 'e',-fill => 'x');
  25.    $e->focus;
  26.   }
  27.  my $o = $w->{'Open'};
  28.  $o->{'url'}  = $w->url;
  29.  $o->Popup;
  30. }
  31.  
  32. 1;
  33.