#!/usr/bin/perl -w
use strict;

# We do not want STDERR to clutter our screen.
open STDERR, ">/dev/null";

use FindBin;
use lib "$FindBin::RealBin/../lib";
use Curses::UI;
my $cui = new Curses::UI ( -clear_on_exit => 1 );

my $win = $cui->add('window_id', 'Window');

$win->add(
        'mybuttons', 'ButtonBox',
        -buttons   => [
	    { -label => '< Button 1 >',
	      -value => 1,
	      -shortcut => '1',
              -command  => sub {
		shift()->root->dialog("This is -command for button 1") }
 	    },{ 
	      -label => '< Button 2 >',
              -value => 2,
	      -shortcut => '2',
              -command  => sub {
		shift()->root->dialog("This is -command for button 2") }
            },
	],
	-border    => 1,
        -buttonalignment => 'right',
);

$win->focus;

my $value = $win->getobj('mybuttons')->get;
$cui->dialog("Your choice: button number $value");

