[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Three questions



Paul du Bois wrote on  Sat, 21 Feb 1998 17:37:50 -0600:

>>(2) Can I put up a dialog window with no buttons and dismiss it myself
>>from MacPerl? ... (3) Can I do the same thing as (2) but modify the
>>text shown in the window now and then? ...
>
>The responses were pretty unanimous that I should use Progress Bar and
>Chris Nandor's MacPerl interface to it.  It does indeed appear that
>combination will do what I want and will give me one solution.
>
>Still, this is for a script that I will be installing on a number of
>other machines.  I'd prefer to minimize the number of other pieces
>besides MacPerl that I need to install, so I think I will look into
>using the Mac::Windows/Mac::Dialogs modules.

Try the module below and see if it will meet your needs. It would be easy
to modify -- different position, size, font, window type, more strings and
so forth.

I would be very interested to hear what you think about it, and happy to
help with any modifications if you want.

Alan Fry

======================================================================

#!perl

# Save this as SimpleStatus.pm and place in a folder
# named 'Mac' in the site-library path.

package Mac::SimpleStatus;

use Mac::Dialogs;

sub new {
    my $pkg = shift;
    my $item = [ 8, new Rect ( 5, 0, 245, 15 ), ''];
    my $bnd = new Rect 14, 24, 264, 39;
    my $dlg = new MacDialog $bnd, '', 1, 1993, 0, ($item);
    my $ref = {};
    $ref->{dlg} = $dlg;
    bless $ref, $pkg
}

sub data {
    my($me, $data) = @_;
    my $dlg = $me->{dlg};
    SetDialogItemText($dlg->window, 1, $data);
}

sub close {
    my $me = shift;
    my $dlg = $me->{dlg};
    dispose $dlg
}

1;

======================================================================

#!perl

# Save this file as 'run_SimpleStatus' and put it any
# convenient place.
# NB there MUST be a close() command somewhere in the
# calling script or the window will get stuck open.

use Mac::SimpleStatus;

$str = 'This window will close in 5 seconds';
$dlg = Mac::SimpleStatus->new();
$dlg->data($str);
sleep(5);
$dlg->close;

======================================================================



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch