[comp.sys.mac.programmer] Window with no menu bar?

David_Anthony_Guevara@cup.portal.com (03/16/89)

I am posting this for a friend.  Please try to direct your responses to him
at the addresses listed below.  If all else fails, forward your responses to
me and I will pass them on to Bob.  Thanks!

=============================================================================

I am writing an application which contains a "welcome" screen.  I would like
this window to occupy the entire Mac+ screen, but I can not get rid of the
blank menu bar which is occupying 20 pixels at the top of the screen.  I am
working in Lightspeed C 3.01.  Does anyone know how to get it so that the
menu bar is not drawn?  I have tried doing a menuinit() call after the 
welcome screen, but no success.

Thanks,

	Robert Ruderman

	UUCP: "...claris!laic!force!ruderman"
	Internet:  "...claris!laic!force!ruderman@pyramid.pyramid.com"

==============================================================================

If you can't get to either one of those addresses send your replies to me at
UUCP:  "...sun!cup.portal.com!David_Anthony_Guevara" or
       "David_Anthony_Guevara@cup.portal.com"
and I will forward them to him.  Thanks for any help you may be able to give!

	Dave Guevara

beard@ux3.lbl.gov (Patrick C Beard) (03/25/89)

In article <15866@cup.portal.com> David_Anthony_Guevara@cup.portal.com writes:
>I am writing an application which contains a "welcome" screen.  I would like
>this window to occupy the entire Mac+ screen, but I can not get rid of the
>blank menu bar which is occupying 20 pixels at the top of the screen.  I am
>working in Lightspeed C 3.01.  Does anyone know how to get it so that the
>menu bar is not drawn?
>Thanks,
>
>	Robert Ruderman

I am posting this as it may be of general interest.  The only way that I've 
found for removing the menu bar is to open a grafport (not a window), and
fill it with the deskttop pattern.  This will draw over the menu bar.  As
far as I know, though, there is no way to have a window overlay the menu
bar.  I hope this helps.


+----------------------------------------------------------------+
 \   Patrick Beard                 "Badges?                       \
  \    Berkeley Systems, Inc.        I ain't got to show you...    \
   \      PCBeard@lbl.gov                 ...NO STINKING BADGES!"   \
    + ---------------------------------------------------------------+

phssra@mathcs.emory.edu (Scott R. Anderson) (03/26/89)

In article <2214@helios.ee.lbl.gov> beard@ux3.lbl.gov (Patrick C Beard) writes:
>In article <15866@cup.portal.com> David_Anthony_Guevara@cup.portal.com writes:
>>I am writing an application which contains a "welcome" screen.  I would like
>>this window to occupy the entire Mac+ screen, but I can not get rid of the
>>blank menu bar which is occupying 20 pixels at the top of the screen.  I am
>>working in Lightspeed C 3.01.  Does anyone know how to get it so that the
>>menu bar is not drawn?
>
>I am posting this as it may be of general interest.  The only way that I've 
>found for removing the menu bar is to open a grafport (not a window), and
>fill it with the deskttop pattern.  This will draw over the menu bar.  As
>far as I know, though, there is no way to have a window overlay the menu
>bar.  I hope this helps.

It *is* possible to cover the entire screen, including the menu bar, by simply
redefining the variable GrayRgn, which defines the region where windows can be
drawn.  (I'm not sure why this information is so obscure, since so many people
seem to need it.)  Here is a fragment which has done the job for me:

	RgnHandle oldGrayRgn, allScreen;
	
	oldGrayRgn = GrayRgn;
	allScreen = NewRgn();
	RectRgn(allScreen, &screenBits.bounds);
	GrayRgn = allScreen;

You can then open a window which will not be clipped to the old GrayRgn.

*
  *      **                  Scott Robert Anderson      gatech!emoryu1!phssra
   *   *    *    **          phssra@unix.cc.emory.edu   phssra@emoryu1.bitnet
    * *      * *    * **
     *        *      *  * * * * * * * * * * * * * * * * * * * * * * * * * * * *

) (04/05/89)

 
I used the following to get a full-screen window.  Note that the menu
bar is not affected.

Setup.  Done once.

	SetRect(&window_bounds, 0, 0,
	    screenBits.bounds.right - screenBits.bounds.left,
	    screenBits.bounds.bottom - screenBits.bounds.top
	);
	window = NewWindow(NIL, &window_bounds, "\p", false, plainDbox, ...);

To display the window (effected by a dialog option):

	SelectWindow(window);
	ShowWindow(window);
	/*
	 * This is needed to get a full-screen window.
	 * It effectively hides the menu bar.  It must
	 * be after ShowWindow().
	 */
	CopyRgn(window->clipRgn, window->visRgn);
	SetPort(window);
	InvalRect(&thePort->portRect);

The update event causes the actual window contents to be drawn.

Note: this is very fragile: the menu bar pops up if you put up a
desk accessory or similar.  Also, SuperClock overwrites the display.

I'm using it for a display application on a dedicated Mac (reads data
from the network and shows it on a display screen).  I've used this on
a non-networked application where the window is displayed after exiting
a dialog.  The main event loop hides the window after a mouse click.
(Yes, I know this violates the guidelines.)
 
Martin Minow
minow%thundr.dec@decwrl.dec.com