[comp.sys.mac.programmer] How to hide the menubar

russell@uswat.uswest.com (Russell Greenlee) (12/05/90)

I know that this has been thrashed out here in the past, but I don't
remember the outcome. I have been doing this by changing the GrayRgn
and setting the height of the menu bar to 0. This seems to work fine
on a Mac II, Mac Plus, or SE, but it leads to system crashes on an fx.
If anyone knows of a better way to do this, I'd love to hear it. How
does Hypercard do it?

Russell Greenlee
russell@uswest.com

leonardr@svc.portal.com (Leonard Rosenthol) (12/06/90)

In article <13513@uswat.UUCP>, russell@uswat.uswest.com (Russell Greenlee)
writes:
> I know that this has been thrashed out here in the past, but I don't
> remember the outcome. I have been doing this by changing the GrayRgn
> and setting the height of the menu bar to 0. This seems to work fine
> on a Mac II, Mac Plus, or SE, but it leads to system crashes on an fx.
> If anyone knows of a better way to do this, I'd love to hear it. How
> does Hypercard do it?
> 
	You ALMOST have it right, but you are doing more work than you have
to - and you can let the system do some for you too..
	First store off the current mBarHeight ($BAA) so that you can restore
it later on - NEVER assume it is 20 as it can vary on other Script Systems.
Then set the mBarHeight to 0 and call DrawMenuBar().  But calling DrawMenuBar,
you let the system do the work of changing GrayRgn (and other stuff).  Try
it, you'll like it!
--
----------------------------------------------------------------------
+ Leonard Rosenthol              | Internet: leonardr@sv.portal.com  +
+ Software Ventures              | GEnie:    MACgician               +
+ MicroPhone II Development Team | AOL:      MACgician1              +
----------------------------------------------------------------------

ksand@Apple.COM (Kent Sandvik) (12/06/90)

In article <13513@uswat.UUCP> russell@uswat.uswest.com (Russell Greenlee) writes:
>I know that this has been thrashed out here in the past, but I don't
>remember the outcome. I have been doing this by changing the GrayRgn
>and setting the height of the menu bar to 0. This seems to work fine
>on a Mac II, Mac Plus, or SE, but it leads to system crashes on an fx.
>If anyone knows of a better way to do this, I'd love to hear it. How
>does Hypercard do it?

...and the MBarHeight global is not supported under A/UX either...
Here's one way to get this to work, i.e. you expand the window to
cover the whole screen by setting the visRgn of the window to the
size of the screenBits.bounds. Note that this method is not permanent
because for instance dialogs will set the visRgn smaller than the 
screen bounds when they are called. So remember to restore the
visRgn.

Here's a bit of Pascal code that seems to do the trick, also with
A/UX 2.0:

Procedure FixIt;
{does the trick of expanding the window so it occupies the whole screen}

BEGIN
   MoveWindow( myWindow, ScreenBits.bounds.left,
               ScreenBits.bounds.top, TRUE );
   SizeWindow( myWindow,
               ScreenBits.bounds.right-ScreenBits.bounds.left,
               ScreenBits.bounds.bottom-ScreenBits.bounds.top,
               FALSE );
   showWindow( myWindow );
   setPort( myWindow );
   rectRgn( myWindow^.visRgn, ScreenBits.bounds );
   invalRect( ScreenBits.bounds );
END;

To restore the visRgn after calling up a dialog:

RectRgn( myWindow^.visRgn, ScreenBits.bounds );
InvalRect( ScreenBits.bounds );


And remember, the Apple User Interface Police don't like people
that create menu-less applications, unless it's a game, or 
presentation software, or a simstim deck.

Hope this helps,
Kent Sandvik

-- 
Kent Sandvik, Apple Computer Inc, Developer Technical Support
NET:ksand@apple.com, AppleLink: KSAND  DISCLAIMER: Private mumbo-jumbo
Zippy says: "With C++ we now do have the possibilities to inherit
dangling pointer problems"