#!../../../perl -w

#
# Purpose:
#	To demonstrate the Perl5 Cdk Dialog Widget.

#
# Initialize Cdk.
#
use Cdk;
Cdk::init();

# Create the dialog buttons.
my @buttons = ("</3>Button 1<!3>",
		"</4>Button 2<!4>",
		"</5>Button 3<!5>",
		"</6>Button 4<!6>");

# Create the dialog message.
my @mesg = ("<C></2>This should be centered<!2>",
		"<L></7>This should be on the left.<!7>",
		"<R></3>This should be on the right.<!3>");

# Create the dialog object.
my $dialog = new Cdk::Dialog ('Mesg' => \@mesg,
				'Buttons' => \@buttons,
				'Xpos' => "CENTER",
				'Ypos' => "CENTER",
				'Highlight' => "A_REVERSE");

# Create a key binding.
$dialog->bind ('Key' => '?', 'Function' => sub {main::callback();});

# Activate the object.
my $button = $dialog->activate();

# Check the results.
if (!defined $button)
{
   popupLabel (["<C>Escape hit. No button selected."]);
}
else
{
   popupLabel (["<C>You selected button $button"]);
}

# Exit Cdk.
Cdk::end();
