[comp.sys.mac.programmer] Button Hilite in Modeless Dlog?

PL430331@tecmtyvm.mty.itesm.mx (10/12/90)

 Anybody know how hilite the buttons in a modeless dialog when a key is
pressed, I do currently:

if Key in [13,3] then   *Check if it Return of enter*
   begin
     GetDItem(TheDialog,OK,TypeItem,ItemHandle,TheBox);
     * get the rect of button to hilite it *
     InvertRect(TheBox); *Invert the bits of the Rect *
     Delay(5, TheCount); *wait a certain amount of time*
     InvertRect(TheBox); *Invert the bits of the Rect again *
     ItemHit:=OK; * assign the event of button to the var ItemHit *
   end;

Could be make it of better manner?.

                                    THANKS

                              Gabriel Ramirez Garza

PL430331@TECMTYVM.MTY.ITESM.MX

stevec@Apple.COM (Steve Christensen) (10/12/90)

PL430331@tecmtyvm.mty.itesm.mx writes:

> Anybody know how hilite the buttons in a modeless dialog when a key is
>pressed, I do currently:
>
>if Key in [13,3] then   *Check if it Return of enter*
>   begin
>     GetDItem(TheDialog,OK,TypeItem,ItemHandle,TheBox);
>     * get the rect of button to hilite it *
>     InvertRect(TheBox); *Invert the bits of the Rect *
>     Delay(5, TheCount); *wait a certain amount of time*
>     InvertRect(TheBox); *Invert the bits of the Rect again *
>     ItemHit:=OK; * assign the event of button to the var ItemHit *
>   end;
>
>Could be make it of better manner?.

Yes, a better way is to use the Control Manager to hilite the control for you.
Instead of the InvertRects, how about:

	HiliteControl(ControlHandle(itemHandle),inButton);
	Delay(5,theCount);
	HiliteControl(ControlHandle(itemHandle),0);

steve

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 whoami?     Steve Christensen
 snail:      Apple Computer, 20525 Mariani Ave, MS-81CS, Cupertino, CA  95014
 Internet:   stevec@goofy.apple.com
 AppleLink:  stevec
 CompuServe: 76174,1712