[comp.sys.mac.programmer] a question about grafports and windows

andre@elvis.cs.pitt.edu (05/23/91)

i have the following code fragment that works except that the ok
button does not have the extra rectangle drawn around it.  if i move
the ShowWindow from its current location to immediately after the
GetNewDialog, the bold rectangle is drawn.  why?

case ABOUT_ITEM:
	qdialog = GetNewDialog(ABOUT_DIALOG_ID, &sdialog,
			       BRING_TO_FRONT);

	/*
	 * get the dialog and add the extra box around the ok
	 * button
	 */
	GetDItem(qdialog, OK_ITEM, &itype, &hitem, &ritem);
	GetPort(&gport);
	SetPort(qdialog);

	PenSize(3, 3);
	InsetRect(&ritem, -4, -4);
	FrameRoundRect(&ritem, 16, 16);
	PenNormal();

	SetPort(gport);

	/*
	 * do the dialog
	 */
	ShowWindow(qdialog);
	ModalDialog(NULL, &i);
	CloseDialog(qdialog);

	break;

							-andre.

Andre Srinivasan  :"If you ain't bleeding, you ain't working."
317 MIB	          :			- Pete The Master Tombstone Cutter
U. of Pittsburgh  :"If it bleeds, we can kill it."
andre@cs.pitt.edu :			- Arnold Schwarzenager