Hi,
>Alan Fry wrote:
>
>I think you might find my 'DialogBuider' program helpful. At least I
>hope you will, for it exactly for this kind of purpose I wrote it.
>It will certainly be able to build you a dialog to do exactly that.
Hmm, thanks a lot. That's a nice programm but my problem isn't
actually not the design|building of the dialog. The definiton of the
buttons, etc. is clear to me. The only problem i have is that i'm not
sure how to update a StaticTextItem inside a dialog, if this typ of
item is the right one for me purpose ;-)
I found something about a update-procedure in an old InsideMacitosh
book about the ToolboxEssentials, but i can't make it work in
MacPerl. It's mentioned in Mac::Dialogs.pm also but i don't
understand the usage :-(
Just to make my problem clear:
I have a dialog with a button, when it's hit the
StandardGetFile-Dialog appears and the user choose a file. After this
is done the filename should be written in the first dialog window.
This should be possible or am i wrong?
Some code:
-- example.pl --
#!perl
use strict;
use warnings;
use Mac::Dialogs;
use Mac::Events;
use Mac::Windows;
use Mac::StandardFile;
my $dlg; # The dialog
my $in; # The input file
my $infilename = "";
$dlg = MacDialog->new(
Rect->new(50, 50, 450, 355),
'Title',
1,
movableDBoxProc(),
0,
[ kButtonDialogItem(),
Rect->new(15, 5, 95, 25), 'File:'],
[ kButtonDialogItem(),
Rect->new(300, 200, 380, 220), 'Cancel'],
[ kStaticTextDialogItem(),
Rect->new(105, 5, 205, 25), "$infilename"],
);
SetDialogDefaultItem($dlg->window(), 1);
SetDialogCancelItem ($dlg->window(), 1);
$dlg->item_hit(1 => \&d1);
$dlg->item_hit(2 => \&d2);
while ($dlg->window()) {
$dlg->modal();
}
sub d1 {
my($dlg) = @_;
$in = StandardGetFile('', 'TEXT');
$infilename = $in->sfFile();
$dlg->update(); # How to use this right??
}
sub d2 {
my($dlg) = @_;
$dlg->dispose();
return(1);
}
END { $dlg->dispose() if (defined($dlg)) }
-- end of example.pl --
I could not find out how this could be done with Alan's
DialogBuilder. When i missed something in the docu please tell me.
Martin