[comp.sys.mac.programmer] Highlighting a button

jem@sauna.HUT.FI (Johan Myreen) (07/13/89)

In article <fgjum#2A0ULD=kari@xanadu.COM> kari@xanadu.COM (Kari Dubbelman) writes:

>But to answer the button question, there is no built-in way to do it
>and this is a serious oversight in the Mac toolbox. IM (I-407)
>recommends you do something like this (with int16 a portable 16-bit
>integer; Warning - shooting-from-the-hip programming below)

   [Program deleted]

>but this causes minor problems in modeless dialog boxes - this routine
>has to be called in the window update routine also, otherwise covering
>windows will cause (pieces of) the highlighting to disappear when
>removed.

No problem here if you do what Inside Macintosh really suggests:
implement it as a UserItem. That is, install a separate UserItem in
the dialog on top of the button to be highlighted. The UserItem has a
bounding rectangle which is four pixels larger in each direction and a
associated procedure which draws a three-pixel thick rounded rectangle
inside the bounding rectangle. Updating the dialog window is then
performed by ModalDialog or DialogSelect, when needed.

>(Modal dialogs work OK).

Not always true. If you put another dialog on top of your modal
dialog, it will need updating when the dialog on top of it disappears.
An example of this is calling SFGetFile from your dialog or Vaccine's
own alert window.

(* Johan Myreen     *)
(* jem@spica.hut.fi *)