#!/usr/bin/perl
use lib qw(/usr/lib/libDrakX);
use interactive;
use strict;
my $in = 'interactive'->vnew();
my $wtitle = "Select From Tree List Example";
my %listdata;
$listdata{"Bread|Wheat"} = { 'plant' => 'grain', 'color' => 'beige' };
$listdata{"Bread|Rye"} = { 'plant' => 'grain', 'color' => 'beige' };
$listdata{"Bread|Pumpernickel"} = { 'plant' => 'grain', 'color' => 'darkbrown' };
$listdata{"Fruit|Apples"} = { 'plant' => 'tree', 'color' => 'red' };
$listdata{"Fruit|Bananas"} = { 'plant' => 'tree', 'color' => 'yellow' };
$listdata{"Fruit|Grapes"} = { 'plant' => 'vine', 'color' => 'purple' };
my $choice = $in->ask_from_treelist(_("%s", $wtitle),
_("Please Make A Choice"),
'|',
['None', keys %listdata],
'Fruit|Apples');
#if $choice is not null, proceed, otherwise exit
$in->ask_warn(_("%s", $wtitle), _("You selected %s,
which comes from a %s, and is colored %s.",
$choice, $listdata{$choice}{plant},
$listdata{$choice}{color})) if ($choice ne "");
$in->exit;