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

Re: [MacPerl-Toolbox] Using an existing window with the Quickdraw



I asked:

>> Is there any way to use an existing [MacPerl] window with QuickDraw?

...and Alan Fry replied:

>The short answer is 'Yes': with MacPerl-ported QuickDraw functions 
>you can draw absolutely anywhere

[One of the nicest, most detailed explanations I've read, deleted]

>'Windows.pm' is essentially an intricate and highly sophisticated 
>Event handling machine. Since Matthias wrote it (three years ago?) I 
>don't think an exception to it (in the sense of a situation where it 
>either failed to do the right thing or proved inflexible) has ever 
>been found and I doubt very much one ever will be. In the MacPerl 
>context only the very brave or maybe foolhardy would even 
>contemplate sidestepping 'Windows.pm' ...

*WOW* Thank you for that explanation!  I will be rereading it a few 
times, side by side with the documentation for the toolbox routines 
and expect to learn a lot!

Let me try to rephrase (and oversimplify) what I saw as the bottom 
line just to make sure I got it:

"You can, but you shouldn't"

The context of the question is that I'd like to write a module which 
provides extremely easy-to-use access to Macintosh graphics for use 
by children, for example, or people who need a little bit of graphics 
capability and cannot justify the investment required to learn the 
Mac toolbox.  I'm thinking that the module should provide a default 
window into which you can draw using commands like:

box( 10, 10, 200, 400 );
line( 10, 10, 50, 50);
pencolor( 'RED');

My thought was that it would be much friendlier and Perl-like if the 
Perl command:

print "This is a test\n";

...output to the same window.

Cris Nandor just posted how to redirect STDOUT to a function.  Given 
that, it is obvious how to have that function use QuickDraw routines 
to put the text into a Windows.pm window.  That looks, at the moment, 
to be the best solution to the problem.

-David-
David Steffen, Ph.D.
President, Biomedical Computing, Inc. <http://www.biomedcomp.com/>
Phone: (713) 610-9770 FAX: (713) 610-9769 E-mail: steffen@biomedcomp.com

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