Path: utzoo!attcan!uunet!ginosko!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!hoptoad!tim
From: tim@hoptoad.uucp (Tim Maroney)
Newsgroups: comp.sys.mac.programmer
Subject: Windows menu and DrawMenuBar
Message-ID: <8320@hoptoad.uucp>
Date: 17 Aug 89 21:51:36 GMT
Organization: Eclectic Software, San Francisco
Lines: 32

I'd like to have some discussion on the proper maintenance of a Windows
menu.  Like many other programs, mine do a complete menu item
enable/disable pass whenever the application detects a menu bar click.
Theoretically, it could be done at some other time more efficiently,
but the code would be harder to maintain.  It's better to have all the
related code grouped together in time and space.

So anyway.  Another thing I do at the same time is rebuild my Windows
menu.  This is a pretty simple piece of code which first truncates the
Windows menu down to a fixed header of generic window operations
("Stack", "Tile", "Next", "Previous"), then appends all the window
titles, iterating down the window list starting at FrontWindow().

The problem is that under System 6.0, it is neccessary to call
DrawMenuBar after adding any items to a menu.  If you don't, they will
not be visible to the user during MenuSelect.  DrawMenuBar causes the
menu bar to flicker, so now, every time the mouse is clicked in the
menu bar, there's a flicker before tracking starts.  I don't like this,
but updating the Windows menu this way is so easy I'm loathe to change
it.

Any suggestions?  Unless I get a better idea, I am going to try doing
the update of the windows menu when any activate event comes in
(including deactivate); if that fails, then I'm going to have to put in
a call to the update windows menu routine whenever a window is created
or destroyed, and I really do not want to do that.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

"I am convinced that cross-posting is an evil Satanic plot."
    -- Eugene Miya on soc.net-people, misc.headlines, misc.kids, misc.misc,
		      news.misc, and soc.misc