[comp.sys.mac.programmer] MDEF Help needed

rlm@naucse.cse.nau.edu (Rich Muller) (03/25/91)

Well, this one is either very subtle or very obvious, but
I can't see it.  I'm writing a simple custom MDEF which should
present a menu in the form of five rectangles, each filled in
with a differnt Pattern.  The mechanics of the MDEF work fine:
the menu appears, the rectangles are presented, they invert as
the user scans down the list, they flash when selected, it returns
the right item number.

But!!

The rectangles, instead of being drawn with a standard Pattern,
appear with something which looks vaguely like Arabic script.

Here's the section of the MDEF code which draws the menu:

	case mDrawMsg:
		
		r.top = menuRectPtr->op + MMARG/2
		r.left = menuRectPtr->left + MMARG;
		r.bottom = r.top + MHEIGHT;
		r.right = r.left + MWIDTH;
		
		for (i = 1; i <= NITEMS; i++) {
		
			PenPat(dkGray);
			PaintRect(&r);
			PenNormal();
						
			OffsetRect(&r, 0, MHEIGHT + MMARG);
		
		}
	break;

The line PenPat(dkGray) is provided here for illustration
only: this should produce NITEMS identical rectangles
filled with the dkGray pattern, but instead it produces five
identical squiggly-filled Rects.

What's the problem?  Other drawing operations in/on the rect
r work fine: I can frame it, fill it with no pattern, fill it
with a color (but not an RGBColor if that's a clue!) and
draw text in it. Does the Window Manager grafPort have special
characteristics -- that's where menus get drawn?

e-mail reply is probably best, unless someone thinks this is of
general interest.

Thanks.  Lots.

Rich Muller

rlm@naucse.cse.nau.edu 
 
-- 

Rich Muller				Flagstaff, AZ
rlm@naucse.cse.nau.edu			602/526-2865
rmuller@hampvms.bitnet

rlm@naucse.cse.nau.edu (Rich Muller) (03/26/91)

I asked for help with an MDEF which wouldn't draw patterns.
Turns out that the QuickDraw globals aren't accessible in
code resources without fiddling with A5 -- Tech Note 208
explains in detail how to use the SetA5() function. 

It was simpler just to make my own versions of the QD
patterns.

Thanks, all.

Rich

-- 

Rich Muller				Flagstaff, AZ
rlm@naucse.cse.nau.edu			602/526-2865
rmuller@hampvms.bitnet