At 10:11 pm -0500 07/03/01, Morbus Iff wrote:
>This is what I hope to accomplish. Can someone help me out?
>
> a) Redirect STDOUT to the window. Newlines need apply, and
> autoscrolling would be helpful. I *do not* want to use
> a Console window - I've already seen the trick of opening
> a pipe to Dev:Console. Font doesn't matter.
>
> b) Clear the whole menu bar, and just have the apple menu,
> a file menu with w/q, and maybe a view menu.
>
>My big problem right now is getting STDOUT to there. I've experimented with
>DrawString, but didn't find a magical way for it to read newlines and so
>forth.
MacOS 'TextEdit' is intended for just this kind of thing. It will
handle line wrapping for instance, which is quite difficult to do
using raw QuickDraw calls, and give you full control over fonts and
styles. Look at TextEdit.pm and study its 'pod' and you will see how
to open up a TE field in your window. Also have a look at the
demonstration script in:
:MacPerl Ÿ:ext:Mac:TextEdit:t:SimpleText.t
which will get you off to a flying start.
"MacPerl Power and Ease" (Chapter 14) pages 212/213 will tell you how
to handle modifications to the MenuBar and create your own Menus.
Further information is given in the 'pod' which is part of 'Menus.pm'
and in the examples to be found in ":ext:Mac:Menus:t:". In your
application you might want to consider doing a Save and Restore for
the Menu Bar, but beware that when you restore you will not get the
'MacPerl Help' back into the 'Help' Menu until MacPerl is relaunched.
I am not quite clear what you mean by 'redirect STDOUT'. Do you mean
redirect the keyboard or 'print()' and 'write()' as well? If the
latter you might look at 'MPEdit.pm' (http://www.afco.demon.co.uk)
which does just that, or at least provides an alternative to
'print()' which directs the output to an editable window.
If you want to create a window which is re-sizeable with horizontal
and vertical scrolling, matters get quite complicated. You might want
to start with something simple in the first instance, and tackle the
more difficult issues later on as they arise.
I hope this helps a little,
Alan Fry