Yurttas/PL/SL/perl/F/11/00/03/entry fields 00.pl

From ZCubes Wiki
Jump to navigation Jump to search
 1#
 2#  Copyright(C) 2003
 3#  All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4#
 5#  Permission from use, copy, modify, and distribute this
 6#  software and its documentation for EDUCATIONAL purposes
 7#  and without fee is hereby granted provided that this
 8#  copyright notice appears in all copies.
 9#
10#  date   : January 1, 2003.
11#  author : (michael saltzman, modern perl programming)
12#
13#  entry_fields_00.pl
14#
15
16
17use Tk;
18
19sub display {
20  open(THISFILE, "< $filename") || die;
21  print while(<THISFILE>);
22  close(THISFILE);
23}
24
25sub clear {
26  $filename = "";
27}
28
29my $mw = MainWindow->new;
30
31$mw->title("sy - entry fields-00");
32
33$mw->Label(-text => "enter filename and select display") ->pack;
34
35$mw->Entry(-textvariable => \$filename) ->pack;
36
37$mw->Button(-text     => "display file",
38            -command  => \&display
39           ) ->pack(-side => "left");
40
41$mw->Button(-text     => "clear entry area",
42            -command  => \&clear
43           ) ->pack(-side => "left");
44
45$mw->Button(-text     => "exit application",
46            -command  => sub{exit}
47           ) ->pack(-side => "left");
48
49
50MainLoop;