home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _90c48c05106ea679c5421b2f5e6b831f < prev    next >
Encoding:
Text File  |  2004-06-01  |  1.7 KB  |  66 lines

  1. # paned2.pl
  2.  
  3. use vars qw/$TOP/;
  4.  
  5. sub paned2 {
  6.  
  7.     # This demonstration script creates a toplevel window containing
  8.     # a paned window that separates two windows vertically.
  9.  
  10.     my($demo) = @_;
  11.     $TOP = $MW->WidgetDemo(
  12.         -name     => $demo,
  13.         -text     => 'The sash between the two scrolled windows below can be used to divide the area between them.  Use the left mouse button to resize without redrawing by just moving the sash, and use the middle mouse button to resize opaquely (always redrawing the windows in each position.)',
  14.         -title    => 'Vertical Paned Window Demonstration',
  15.         -iconname => 'paned2',
  16.     );
  17.  
  18.     my $pw = $TOP->Panedwindow(qw/-orient vertical/);
  19.     $pw->pack(qw/-side top -expand yes -fill both -pady 2 -padx 2m/);
  20.  
  21.     my $paneList = [
  22.         'List of Tk Widgets', qw/
  23.         button
  24.         canvas
  25.         checkbutton
  26.         entry
  27.         frame
  28.         label
  29.         labelframe
  30.         listbox
  31.         menu
  32.         menubutton
  33.         message
  34.         panedwindow
  35.         radiobutton
  36.         scale
  37.         scrollbar
  38.         spinbox
  39.         text
  40.         toplevel
  41.         /,
  42.     ];
  43.  
  44.     my $f1 = $pw->Frame;
  45.     my $lb = $f1->Listbox(-listvariable => $paneList);
  46.     $lb->pack(qw/-fill both -expand 1/);
  47.     my ($fg, $bg) = ($lb->cget(-foreground), $lb->cget(-background));
  48.     $lb->itemconfigure(0, 
  49.     -background => $fg,
  50.         -foreground => $bg,
  51.     );
  52.  
  53.     my $f2 = $pw->Frame;
  54.     my $t = $f2->Text(qw/-width 30 -wrap none/);
  55.  
  56.     $t->grid(qw/-sticky nsew/);
  57.     $f2->gridColumnconfigure(qw/0 -weight 1/);
  58.     $f2->gridRowconfigure(qw/0 -weight 1/);
  59.     $t->insert('1.0', 'This is just a normal text widget');
  60.     
  61.     $pw->add($f1, $f2);
  62.  
  63. } # end paned2
  64.  
  65. 1;
  66.