[comp.sys.mac.programmer] Minor patch to SFPopupPutFile

greggor@apple.com (Greg L. Anderson) (10/07/90)

Please replace the routine "FlashDlogItem" with the one posted below.
The old version worked (for standard sized buttons only), but it was
a prime example of poor Macintosh programming techniques.  (I pulled
it out of a VERY old piece of code at the last minute.)

One of the fundimental rules of Macintosh Programming:  use routines
available to you before attempting to re-implement them yourself.

The new version is more Macintosh-friendly, and will work for buttons
of any size or shape (Of course, your choice of shape is pretty much
limited to rounded-rectangles. :> ).


/*----------------------------------------------------------------------
|  Momentarily hilite a dialog button
----------------------------------------------------------------------*/
void FlashDlogItem( DialogPtr dlog, short itemNum )
{
	Handle		itemHandle;
	short		itemType;
	Rect		iRect;
	long		ticky;
	
	GetDItem(dlog,itemNum,&itemType,&itemHandle,&iRect);
	HiliteControl(itemHandle,1);
	Draw1Control(itemHandle);
	ticky = TickCount() + 10;
	while( ticky > TickCount() );
	HiliteControl(itemHandle,0);
	Draw1Control(itemHandle);
}

  ___\    /___               Greg Anderson              ___\    /___ 
  \   \  /   /         Advanced Technology Group        \   \  /   /
   \  /\/\  /            Apple Computer,  Inc.           \  /\/\  /
    \/    \/               greggor@apple.com              \/    \/