Path: utzoo!attcan!uunet!pyrdc!pyrnj!rutgers!mailrus!chianti!shane From: shane@chianti.cc.umich.edu (Shane Looker) Newsgroups: comp.sys.mac.programmer Subject: Re: Highlight "OK" buttons Summary: Source code included Keywords: Dialogs Message-ID: <680@mailrus.cc.umich.edu> Date: 8 Sep 88 21:57:17 GMT References: <3316@homxc.UUCP> Sender: usenet@mailrus.cc.umich.edu Reply-To: shane@um.cc.umich.edu (Shane Looker) Organization: University of Michigan Computing Center, Ann Arbor Lines: 58 [Geez. You don't check news for a few days and everybody goes crazy...] In article <3316@homxc.UUCP> paco@homxc.UUCP (Herbert Throckmorton) writes: > [ Basically, how do I highlite the default button? ] > > John Scoggins > att!homxc!paco Here is the code I throw into my applications/whatevers which need to have a dialog button highlighted... ---------------------------------------------------- Set_Hilite(dlog, itemNo) DialogPtr dlog; /* The DialogPtr to work with */ short itemNo; /* Which item is the UserItem */ { Rect Box; pascal void Hilite_Default(); GetDItem(dlog, itemNo, NIL, NIL, &Box); /* Grab the item rectangle */ /* Now setup the procedure for it */ SetDItem(dlog, itemNo, userItem, (Handle) Hilite_Default, &Box); } pascal void Hilite_Default(theWindow, itemNo) WindowPtr theWindow; short itemNo; { Rect Box; /* NOTE!: #define OK 1 for most dialog boxes. */ GetDItem(theWindow, OK, NIL, NIL, &Box); /* Grab the display rect */ InsetRect(&Box, -4, -4); /* Move out a bit */ PenSize(3,3); /* Set the pen */ FrameRoundRect(&Box, 16, 16); /* Frame it */ PenSize(1,1); /* Fix the Pen */ } ----------------------------------------------------- Now do : dlog = GetNewDialog(xxx, NIL, (WindowPtr) -1); Set_Hilite(dlog, USER_ITEM_NUMBER); Nothing mystical here. NIL is #defined to be 0L. Shane Looker Looker@um.cc.umich.edu