[comp.sys.mac.programmer] WDEF not getting wInGoAway message though goAway box works

6600pete@ucsbuxa.ucsb.edu (GurgleKat [Pete Gontier]) (03/12/90)

/*

I'm writing a WDEF. When there is a click in its goAway box, my WDEF
sends back wInGoAway and the window closes accordingly. So I have some
decent reason to believe that the Window Manager sees my wInGoAway and
tells the application about it. However, my WDEF never receives a
corresponding draw message, i.e. one that says "Draw your goAway box
in whatever highlighted form to indicate its selection," specifically
param == wInGoAway. Why?

Here's the offending code, methinks:

*/

long doWHit ( WindowPeek theWindow, long param, int varCode ) {
 
	Point p; 
	long result = noHit;

	SetPt ( &p, LoWord ( param ), HiWord ( param ) ); 

	/* ... */
		{
			Rect	boxR = GetGoAwayRect ( theWindow );
			if ( PtInRect ( p, &boxR ) )
				result = wInGoAway;
		}
	/* ... */
	return ( result );
}

/* unterminated comment follows...
--
Pete Gontier   | InterNet: 6600pete@ucsbuxa.ucsb.edu, BitNet: 6600pete@ucsbuxa
Editor, Macker | Online Macintosh Programming Journal; mail for subscription
Hire this kid  | Mac, DOS, C, Pascal, asm, excellent communication skills

duggie@jessica.Stanford.EDU (Doug Felt) (03/13/90)

In article <4273@hub.UUCP> 6600pete@ucsbuxa.ucsb.edu (GurgleKat [Pete Gontier]) writes:

>I'm writing a WDEF. When there is a click in its goAway box, my WDEF
>sends back wInGoAway and the window closes accordingly. So I have some
>decent reason to believe that the Window Manager sees my wInGoAway and
>tells the application about it. However, my WDEF never receives a
>corresponding draw message, i.e. one that says "Draw your goAway box
>in whatever highlighted form to indicate its selection," specifically
>param == wInGoAway. Why?

Occasionally the writers of the Toolbox, in their infinite wisdom, see
fit to leave garbage in the unused portions of parameters they send to
us mere mortals.  The parameter passed with the draw message to a WDEF
apparently only uses the lower 16 bits.

I suggest trying (param & 0xffff) == wInGoAway.

You might wonder why this isn't documented.  I do.

>Pete Gontier   | InterNet: 6600pete@ucsbuxa.ucsb.edu, BitNet: 6600pete@ucsbuxa
>Editor, Macker | Online Macintosh Programming Journal; mail for subscription
>Hire this kid  | Mac, DOS, C, Pascal, asm, excellent communication skills

Doug Felt