#!/usr/bin/perl -w
######################################################################
# (c) Michael Schilli 1999
######################################################################

use Tk;
use Tk::Dialog;

$top = MainWindow->new();

$top->Button(-text => "Dialog starten", 
             -command => sub { dialog($top); })->pack();
$top->Button(-text => "Exit", 
             -command => sub { exit 0 } )->pack();
MainLoop;

sub dialog {
    my $top = shift;

    my $okButton     = 'OK';
    my $cancelButton = 'Cancel';
    my $helpButton   = 'Help';
    
    my $dialog = $top->Dialog(
               -title  => 'Titel',
               -text   => 'Text der Fehlermeldung usw. usw.',
               -bitmap => 'info',
               -default_button => $okButton,
               -buttons => 
                     [$okButton, $cancelButton, $helpButton]);

    if(($returnButton=$dialog->Show('-global')) eq $okButton) {
        print "OK\n";
    } elsif ($returnButton eq $cancelButton) {
        print "Cancel\n";
    } elsif ($returnButton eq $helpButton) {
        print "Help\n";
    }
}
