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

[MacPerl] Updating a window in MacPerl



First, I would like to express my appreciation for MacPerl, which has
allowed me to accomplish a task I could not have practically succeeded
at using other tools.

Now for my question: I made an attempt to write a "progress bar" for my
MacPerl script, but have encountered problems in updating it.

To explain, the progress window is declared with:

 $win     = MacWindow->new( NewCWindow( $winRect, "", 1, floatSideProc, 1));
 $win->sethook("redraw", \&progress_win);

and the sub progress_win redraws the window's content region, including
the progress bar.

I attempt to update the window via a periodic call to:

sub progress_break { #MacOS-specific
     $progress = $INchars / $inputSize;
	InvalRect( $winRect) if ( defined( $winRect) );
	WaitNextEvent();
}

where $winRect is the region corresponding to the progress bar, and
$progress is a global variable that will determine the length of the
progress bar.

To round off my explanation, progress_break is called from time to time
as the script executes, hopefully at more or less regular intervals. 

I tested my code, and it works to some extent, in that the window is
correctly drawn when sub progress_win is called.

I know these details are somewhat sketchy (I haven't mentioned exactly
what my problem is, I know), but I would appreciate hearing from anyone
on this list who has some reflections on the basic technique I have used
here. Is it sound?

Also, has anyone seen similar work posted anywhere? I'd like to compare notes.

And if it is deemed worthwhile, I would like to post my code once I am
satisfied that it can pass muster.

Art Ogawa
TeX Consultants

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org