so when ever i run this the Email button does come but after input their is no text at all. so i curse and i am not able to wrap my head around it so... any Advice???my $EMAIL; $w{2}->add(undef, 'Buttonbox', -y => -7, -buttons => [ { -label => " [EMAIL] ", -value => 1, -onpress => sub { my $cui=shift()->root; $EMAIL = $cui->question("PLEASE ENTER +EMAIL:"); if ($EMAIL) { $w{2}->add( undef, 'Label', -y => -10, -text => "The email you entere +d is $EMAIL\n"); } else { $cui->dialog("Question cancelled."); } }, }, ], );
as i said before i am using Curses::UI only as i am not able to use the other other libraries probably due to fault of my own as i did include it but when i run them nothing happens even when i tried running the example scripts provided by cpan. i tried using this and it had come into my attention that what i want is that every time i press and enter an email i get a text message below stating what i had typed. after typing it the text message doesnt get display untill i dont press the button once again on top of that if i try changing it the email variable may change in the background but it would always display the same thing what i entered first for example:#!/usr/bin/perl -w use strict; use warnings; use File::Temp qw( :POSIX ); use lib "../lib"; # make KEY_BTAB (shift-tab) working in XTerm # and also at the same time enable colors #$ENV{TERM} = "xterm-vt220" if ($ENV{TERM} eq 'xterm'); my $debug = 0; if (@ARGV and $ARGV[0] eq '-d') { my $fh = tmpfile(); open STDERR, ">&fh"; $debug = 1; } else { # We do not want STDERR to clutter our screen. my $fh = tmpfile(); open STDERR, ">&fh"; } use FindBin; use lib "$FindBin::RealBin/../lib"; use lib "$FindBin::RealBin/perllib"; use Curses::UI; # Create the root object. my $cui = new Curses::UI ( -clear_on_exit => 1, -debug => $debug, -color_support => 1, ); # Demo index my $current_demo = 2; # Demo windows my %w = (); # -------------------------------------------------------------------- +-- # Create the explanation window # -------------------------------------------------------------------- +-- my $w0 = $cui->add( 'w0', 'Window', -border => 1, -y => -1, -height => 3, -bfg => 'red', ); $w0->add('explain', 'Label', -text => "CTRL+B: Back CTRL+O: Options " . "CTRL+X: Menu CTRL+Q: Quit" ); # -------------------------------------------------------------------- +-- # Creating the windows for the front end # -------------------------------------------------------------------- +-- my %screens = ( '2' => 'Options page', ); my @screens = sort {$a<=>$b} keys %screens; my %args = ( -border => 1, -titlereverse => 1, -padtop => 0, -padbottom => 5, -ipad => 5, -bfg => 'red', ); while (my ($nr, $title) = each %screens) { my $id = "window_$nr"; $w{$nr} = $cui->add( $id, 'Window', -title => "Curses::UI demo: $title The APE Test($nr/" . @scree +ns . ")", %args,); $w{$nr}-> add( undef,'Label', -y => 0, -x => 5, -bfg => 'blue', -text => " _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ \n" . "|_ _| | | | | | _ _| | _ | | _ | | +_ _| |_ _| | _ _| | _ _| |_ _| \n" . " | | | |_| | | |_ _ | |_| | | |_| | | | +_ _ | | | |_ _ | |_ _ | | \n" . " | | | _ | | _ _| | _ | | _ _| | +_ _| | | | _ _| |_ _ | | | \n" . " | | | | | | | |_ _ | | | | | | | | +_ _ | | | |_ _ _ _| | | | \n" . " |_| |_| |_| |_ _ _| |_| |_| |_| |_ +_ _| |_| |_ _ _| |_ _ _| |_| \n" ); } ########################## ##### OPTIONS PAGE ##### ########################## my $EMAIL; $w{2}->add( undef, 'Label', -y => -10, -text => "Please add email address here below in the event that th +e results will be mailed to you(Optional)\n" ); my $temp; $w{2}->add(undef, 'Buttonbox', -y => -7, -buttons => [ { -label => " [EMAIL] ", -value => 1, -onpress => sub { my $cui=shift()->root; $EMAIL = $cui->question("PLEASE ENTER EMAIL:"); if ($EMAIL) { $w{2}->add( undef, 'Label', -y => -5, -text => "The email you entered is $EMAIL\ +n"); } else { $cui->dialog("Question cancelled."); } }, }, ], ); # -------------------------------------------------------------------- +-- # Setup bindings and focus # -------------------------------------------------------------------- +-- # Bind <CTRL+Q> to quit. $cui->set_binding( sub{ exit }, "\cQ" ); # Bind <CTRL+X> to menubar. $cui->set_binding( sub{ shift()->root->focus('menu') }, "\cX" ); sub goto_next_demo() { $current_demo++; $current_demo = @screens if $current_demo > @screens; $w{$current_demo}->focus; } $cui->set_binding( \&goto_next_demo, "\cN" ); sub goto_prev_demo() { $current_demo--; $current_demo = 1 if $current_demo < 1; $w{$current_demo}->focus; } $cui->set_binding( \&goto_prev_demo, "\cB" ); sub goto_Options() { $w{2}->focus; } $cui->set_binding( \&goto_Options, "\cO" ); $w{$current_demo}->focus; # -------------------------------------------------------------------- +-- # Get things rolling... # -------------------------------------------------------------------- +-- $cui->mainloop;
In reply to Difficulty with Curses by perlassassin27
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |