> I have an idea for a neat, small, user interface widget, but I'm not
> comfortable at all with Toolbox calls... so perhaps someone else might
> want to pick it up?
> 
> The idea is a small status/progress window. Currently, I send all status
> messages to MacPerl's text output window, but as an interface, that
> looks like ancient technology.
> 
> So I suggest making a small window appear, a bit like a dialog box, but
> modeless (doesn't wait for confirmation -- doesn't even need a button),
> in which you can put your message. You can update the message as your
> script progresses... Perhaps even by tieing STDERR to this as output!

A couple years ago there was a module called Mac::SimpleStatus posted on
this list which does that. Or, you could use this code I happen to have:

use constant WINV => 16;
use vars qw($MonWin $MonPort $MonWid);
{
  local ($DB::single, $DB::trace) = (0, 0);
  $MonWid ||= 210;
  $MonWin and $MonWin->dispose;
  $MonWin = MacColorWindow->new(
    Rect->new(20, 40, 200, 40+WINV),
    "mpMUD", 1, floatGrowProc, 1
  );
  $MonWin->sethook(drawgrowicon => sub {1});
  $MonWin->sethook(goaway => sub {
    my($my,$pt) = @_;
    exit if TrackGoAway($my->{port}, $pt); 1;
  });
  $MonWin->sethook(grow => sub {
    my($my,$pt) = @_;
    if (my($w,$h) = GrowWindow($my->{port}, $pt, Rect->new(30, WINV, 1024, WINV * 
10))) {
      $my->invalgrowarea;
      SizeWindow($my->{port}, $MonWid = $w, $h);
      $my->invalgrowarea;
      $my->layout;
    }
    1;
  });
  SetPort $MonPort = $MonWin->window;
  TextSize(9);
  $MonWin->drawgrowicon;
}

sub mon_set {
  return unless $MonWin and $MonWin->window;
  local ($DB::single, $DB::trace) = (0, 0);
  SetPort($MonPort);
  MoveTo(3, WINV - 5);
  EraseRect(Rect->new(0, 0, $MonWid, WINV));
  DrawString($_[0]);
}

END {$MonWin->dispose if $MonWin;}

__END__


-- 
Kevin Reid

Reply via email to