Curses-UI-POE

 view release on metacpan or  search on metacpan

examples/demo-widgets  view on Meta::CPAN


$w{7}->onFocus( sub{$cui->enable_timer  ('progressbar_demo')} );
$w{7}->onBlur(  sub{$cui->disable_timer ('progressbar_demo')} );

# ----------------------------------------------------------------------
# Calendar
# ----------------------------------------------------------------------

$w{8}->add(
    undef, 'Label',
    -text => "The calendar can be used to select a date, somewhere between\n"
           . "the years 0 and 9999. It honours the transition from the\n"
	   . "Julian- to the Gregorian calender in 1752."
);

$w{8}->add(
    undef, 'Label',
    -y => 5, -x => 27,
    -text => "Use your cursor keys (or <H>, <J>, <K> and <L>)\n"
           . "to walk through the calender. Press <ENTER>\n"
	   . "or <SPACE> to select a date. Press <SHIFT+J> to\n"
	   . "go one month forward and <SHIFT+K> to go one\n"
	   . "month backward. Press <SHIFT+L> or <N> to go one\n"
	   . "year forward and <SHIFT+H> or <P> to go one year\n"
	   . "backward. Press <T> to go to today's date. Press\n"
	   . "<C> to go to the currently selected date."
);

$w{8}->add(
    'calendarlabel', 'Label',
    -y => 14, -x => 27,
    -bold => 1,
    -width => -1,
    -text => 'Select a date please...'
);

$w{8}->add(
    'calendar', 'Calendar',
    -y => 4, -x => 0,
    -border => 1,
    -onchange => sub {
        my $cal = shift;
	my $label = $cal->parent->getobj('calendarlabel'); 
	$label->text("You selected the date: " . $cal->get);
    },
);

# ----------------------------------------------------------------------
# Dialog::Basic
# ----------------------------------------------------------------------

$w{9}->add(
    undef, 'Label',

examples/demo-widgets  view on Meta::CPAN

    ]
);

# ----------------------------------------------------------------------
# Dialog::Calendar
# ----------------------------------------------------------------------

$w{14}->add(
    undef, 'Label',
    -text => "Curses::UI::POE has a number of ready-to-use dialog windows.\n"
           . "The calendar dialog is one of them. Using this dialog\n"
	   . "it is possible to select a date."
);

$w{14}->add( undef,  'Label', -y => 7, -text => 'Date:' );
$w{14}->add( 
    'datelabel', 'Label', 
    -width => 10, 
    -y => 7, 
    -x => 6, 
    -text => 'none',

examples/demo-widgets  view on Meta::CPAN

    -y => 7,    
    -x => 17,
    -buttons => [
         { 
	   -label => "< Set date >",
	   -onpress => sub { 
	       my $label = shift()->parent->getobj('datelabel');
	       my $date = $label->get;
	       print STDERR "$date\n";
	       $date = undef if $date eq 'none';
	       my $return = $cui->calendardialog(-date => $date);
	       $label->text($return) if defined $return;
	   }
         },{
	   -label => "< Clear date >",
	   -onpress => sub {
	       my $label = shift()->parent->getobj('datelabel');
	       $label->text('none');
	   }
	 }
    ]



( run in 0.360 second using v1.01-cache-2.11-cpan-c333fce770f )