[comp.sys.mac.programmer] Strange Behavior

jdm@ut-emx.UUCP (Jim Meiss) (11/19/88)

	Has anyone else noticed that when a popup menu is to be 
drawn near the top or bottom of the screen, 
then the menu rectangle has a blank part.
E.g. near the top of the screen you'd get this:
	-------------------  <-Top of screen
		|   ^	|
		|Item 3	|
		|Item 4	|
Selection Point	|Item 5	|
		|	|
		|	|
		|	|
		--------    <-Lower bound of Menu Box

This happens in my own code, and I also found commercial
applications (i.e. Pagemaker 3.0) which do this, so it
seems to me to be a bug in System 6.0.2.
	Sure looks wierd even if one wouldn't call it 
a bug...

									
				Jim Meiss				
		 		jdm@emx.utexas.edu
				jdm%uta.MFENET@nmfecc.ARPA
									
-------------------------------------------------------------------------
				

tecot@Apple.COM (Ed Tecot) (12/05/88)

In article <8008@ut-emx.UUCP> jdm@ut-emx.UUCP (Jim Meiss) writes:
>	Has anyone else noticed that when a popup menu is to be 
>drawn near the top or bottom of the screen, 
>then the menu rectangle has a blank part.
>E.g. near the top of the screen you'd get this:
>	-------------------  <-Top of screen
>		|   ^	|
>		|Item 3	|
>		|Item 4	|
>Selection Point	|Item 5	|
>		|	|
>		|	|
>		|	|
>		--------    <-Lower bound of Menu Box
>
>This happens in my own code, and I also found commercial
>applications (i.e. Pagemaker 3.0) which do this, so it
>seems to me to be a bug in System 6.0.2.
>	Sure looks wierd even if one wouldn't call it 
>a bug...

It's not a bug, it's not even a feature.  It's the way it has to work.
Think about it.  When a menu pops up, a certain item must appear under
the mouse.  If there is not enough room to do that without clipping the menu,
the menu must scroll.  However, the menu MUST reserve enough space to bring
the entire menu into view if the user scrolls it, hence the blank space
below or above.

						_emt

siegel@endor.harvard.edu (Rich Siegel) (12/05/88)

In article <21657@apple.Apple.COM> tecot@Apple.COM (Ed Tecot) writes:

>It's not a bug, it's not even a feature.  It's the way it has to work.

	I beg to differ. LightspeedC and Lightspeed Pascal make use of a 
little MDEF that sits on top of the standard MDEF and handles the popup
message. The patch MDEF works in combination with a stub for PopUpMenuSelect;
the stub set's the Window Manager port's value to a big number, calls the
patch MDEF's CalcMenuSize, and restores the window manager port's portRect.
The patch MDEF checks to see where the top and bottom of the menu rectangle
are, compared to the height of the menu, and adjusts the menu's menuRect
so that there's no whitespace on either end.

		--Rich




Rich Siegel
Staff Software Developer
THINK Technologies Division, Symantec Corp.
Internet: siegel@endor.harvard.edu
UUCP: ..harvard!endor!siegel
Phone: (617) 275-4800 x305

Any opinions stated in this article do not necessarily reflect the views
or policies of Symantec Corporation or its employees.

tecot@Apple.COM (Ed Tecot) (12/19/88)

In article <763@husc6.harvard.edu> siegel@endor.UUCP (Rich Siegel) writes:
>In article <21657@apple.Apple.COM> tecot@Apple.COM (Ed Tecot) writes:
>
>>It's not a bug, it's not even a feature.  It's the way it has to work.
>
>	I beg to differ. LightspeedC and Lightspeed Pascal make use of a 
>little MDEF that sits on top of the standard MDEF and handles the popup
>message. The patch MDEF works in combination with a stub for PopUpMenuSelect;
>the stub set's the Window Manager port's value to a big number, calls the
>patch MDEF's CalcMenuSize, and restores the window manager port's portRect.
>The patch MDEF checks to see where the top and bottom of the menu rectangle
>are, compared to the height of the menu, and adjusts the menu's menuRect
>so that there's no whitespace on either end.

Then tell me, what happens when the menu is scrolled?  Since you've truncated
the menu height, you can no longer see the entire menu after it has been
scrolled.  In addition, in some cases, you might make the menu so small that
no items are visible.  I'd call that a bug.  The MDEF must work this way
or it could not ensure that the entire menu is visible and the desired item
is under the cursor.

							_emt

wrs@Apple.COM (Walter Smith) (12/20/88)

In various articles, Ed Tecot and Rich Siegel have been flaming each other
about pop-up menus.

Well, it's always seemed to me that a menu in a nasty situation like the
ones popup menus always seem to be in should just *change its size* as it's
scrolling around.  Apparently someone else had this opinion, too, as we see
from the following comment in the menu defproc source code:

; Historical Note:
; It would be desireable to have popups change vertical size as they scrolled, 
; instead of having all that white space when the scrolling menu is first 
; displayed.  The reason for this is due to the design of the MBDF.  
; The MBDF saves the bits behind and draws the drop shadow at the same
; time.  If there were two messages instead, one to save the bits behind
; and one to draw the drop shadow, the we could save all of the bits behind
; the menurect, from the top of the screen to the bottom, and then change
; the menu's vertical height without worrying about saving more bits each
; time it got bigger.  But we can't, so...

In the narrow sense, I'm afraid Ed's right, but if you look at the Big
Picture I'm afraid you're both wrong...

- Walt
--
Walter Smith				wrs@apple.com, apple!wrs
Apple Computer, Inc.			(408) 974-5892
My corporation disavows any knowledge of my activities on the network.

siegel@endor.harvard.edu (Rich Siegel) (12/21/88)

In article <22465@apple.Apple.COM> tecot@Apple.COM (Ed Tecot) writes:
>>The patch MDEF checks to see where the top and bottom of the menu rectangle
>>are, compared to the height of the menu, and adjusts the menu's menuRect
>>so that there's no whitespace on either end.
>
>Then tell me, what happens when the menu is scrolled?  Since you've truncated
>the menu height, you can no longer see the entire menu after it has been

	Read what I wrote. It *adjusts* *the* *menu* *rectangle*. This means
that the rectangle gets shifted up if it's at the bottom of the screen,
down if it's at  the top, and so forth. In fact, I believe the stanard MDEF
does this. The point is, no items get truncated, and you can always scroll
the full range of of items.

	An example of this MDEF is the font menu in LightspeedC 3.0's
font selection dialog.

		--Rich


Rich Siegel
Staff Software Developer
THINK Technologies Division, Symantec Corp.
Internet: siegel@endor.harvard.edu
UUCP: ..harvard!endor!siegel
Phone: (617) 275-4800 x305

Any opinions stated in this article do not necessarily reflect the views
or policies of Symantec Corporation or its employees.