Path: utzoo!utgpu!water!watmath!clyde!att-cb!att-ih!pacbell!ames!eos!labrea!decwrl!chgv04.dec.com!lampson From: lampson@chgv04.dec.com (Mike Lampson, Central Area Prove-It Delivery Specialist) Newsgroups: comp.sys.mac.programmer Subject: Re: How do you highlight a default button? Message-ID: <8804030612.AA02313@decwrl.dec.com> Date: 3 Apr 88 08:14:00 GMT Organization: Digital Equipment Corporation Lines: 50 One thing IUve noticed about hilighting default buttons is that most dialog default buttons lose their hilighting when the dialog is updated. You can see this in most applications when the screen is updated after restoring from a screen saver or when switching back to the application under MultiFinder or Switcher. To "fix" this you need to create a fake userItem and call SetDItem to set the procedure below as the MyItem procedure for this fake userItem. I'm still a novice Mac Programmer, so if anyone sees any problems with this routine, please let me know. The following is used in my LSP programs: {----------------------------------------------------------------- } { Put a frame around the specified Dialog button - usually 1 } { This procedure has two parameters. The second parameter is } { essentially a dummy parameter so that this routine may be } { specified as a MyItem routine } {----------------------------------------------------------------- } PROCEDURE DLOGFrameDefault(DLOGptr:dialogPtr,itemNo:integer); VAR curPen : PenState; theItemType : integer; theItemHandle : Handle; theRect : rect; DLOGdata : DialogPeek; BEGIN DLOGdata := DialogPeek(DLOGptr); GetDItem(DLOGptr, DLOGdata^.aDefItem, theItemType, theItemHandle, theRect); IF theItemType = (ctrlItem + btnCtrl) THEN BEGIN GetPenState(curPen); PenSize(3, 3); InsetRect(theRect, -4, -4); FrameRoundRect(theRect, 16, 16); SetPenState(curPen) END END; -- Mike . /| / |\ /__|_\ -------------.^^^^^^^^^^^^^^^^^^^\_____/^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^. ---- Mike Lampson `--------. / Digital Equipment Corp. \ . / Arlington Heights, IL \ . / `----------------^----------------------' UUCP: {allegra,decvax,hplabs,ihnp4,ucbvax,...}!decwrl!chgv04.dec.com!lampson ARPA: Lampson@CHGV04.DEC.COM -or- Lampson%CHGV04.dec@DECWRL.DEC.COM GEnie: M.LAMPSON ---- ----