1 # Tk I/O for DCT, by Shiar
4 # 1.12.0 200410312115 - test
14 push @{$hook{init}}, sub {
15 $main = new MainWindow;
16 $main->Label(-text=>"test")->pack;
17 ReadMode 3; # cbreak mode
21 } # restore terminal on quit
23 # $set{height} = $LINES-2 if $LINES>=3;
24 # $set{width} = $COLS if $COLS;
28 push @{$hook{showerror}}, sub {
35 ReadKey; # wait for confirm
36 1 while defined ReadKey(-1); # clear key buffer
40 push @{$hook{showstack}}, sub {
41 my $box = $main->Listbox(
43 -width => -1, # shrink to fit
49 $box->insert('end', "$_: ".showval($stack[$_], $set{base}));
52 $box->pack(-side => 'left', -fill => 'both', -expand => 'yes');
54 # addstr($set{height}-$_, 1, "$_: ".showval($stack[$_], $set{base}));
57 # clrtoeol($set{height}-@stack, 1);
60 push @{$hook{showall}}, sub {
62 # addstr($set{height}+1, 0, "> "); # prompt
63 $main->Label(-text=>"> ")->pack;
66 push @{$hook{showentry}}, sub {
67 $main->Label(-text=>$_[0])->pack;
68 # addstr($set{height}+1, 2, $_[0]);
74 my $in = $main->Entry(-width=>10);
79 onkey($_) for split //, $in->get;
88 # my $key = ReadKey; # wait for user input
89 # if ($key eq chr 27) {
90 # $key .= $_ while defined ($_ = ReadKey(-1)); # read additional keys