Mac::Dialog modify Text on a Button

[email protected] ("Kummerant, Stefan") Fri, 16 Apr 2004 17:07:04 +0200
Newsgroups perl.macperl.toolbox
Message-ID <[email protected]>
Hallo,
after several hours staering at this peanuts programm and searches in the
net, I hope to get some help here.
This GUI has 2 Buttons: One is only to close the Dialogbox tidy, and the
other should change it`s marking from "Text_alt" to "neuer_Text".
But, if I click on "Text_alt" my MAC stalls.
Best Regards Stefan

Die GUI hat 2 Knoepfe: Einer ist nur dazu da die Dialogbox ordentlich zu
schliessen. Der andere soll nur die Beschriftung von "Text_alt" zu
"neuer_Text" aendern.
Aber, wenn ich darauf klicke haengt sich mein MAC auf.
Im voraus vielen Dank Stefan

#!perl -w
use Mac::Windows;
use Mac::QuickDraw;
use Mac::Events;
use Mac::Dialogs;
$dlg =3D MacDialog->new(
         Rect->new(50,50,140,120), 'minidialog', 1, movableDBoxProc(), 0,
           [ kButtonDialogItem(), Rect->new(10,10,80,30), 'Text_alt' ],
           [ kButtonDialogItem(), Rect->new(10,40,80,60), 'ende' ],
);

$dlg->item_hit(1 =3D> \&d1);
$dlg->item_hit(2 =3D> \&d2);


while ($dlg->window()) {
 WaitNextEvent();
}


END {
 $dlg->dispose() if defined($dlg);
}


sub draw_it {}


sub d1{
 my ($dlg, $item) =3D @_;
 $dlg->item_text($item, "neuer_Text");
 return(1);
}


sub d2{
 #### Ende Taste ####
 my ($dlg, $item) =3D @_;
 $dlg->dispose();
 return(1);
}


__END__