[comp.sys.mac.programmer] OK button and return in modeless dialog

lulue@manta.NOSC.MIL (Dan Lulue ) (06/21/89)

In a modal dialog the user can click the OK button or hit return and the
OK button will blink.  How does one get this behavior in a modeless
dialog?  Do I need to get the key down event, figure out that it was the
enter key, and then toggle the OK button?  I am undoubtedly missing
something.

Thanks,
Dan.

lulue@nosc.mil

earleh@eleazar.dartmouth.edu (Earle R. Horton) (06/21/89)

In article <846@manta.NOSC.MIL> lulue@manta.NOSC.MIL (Dan Lulue ) writes:
>In a modal dialog the user can click the OK button or hit return and the
>OK button will blink.  How does one get this behavior in a modeless
>dialog?  Do I need to get the key down event, figure out that it was the
>enter key, and then toggle the OK button?  I am undoubtedly missing
>something.
>

     Yes.  This is exactly what you want to do.  Make sure you check
for both return (13 decimal) and enter (3 decimal).

Earle R. Horton
"People forget how fast you did a job, but they remember how well you
did it."  Salada Tag Lines

d88-jwa@nada.kth.se (Jon W{tte) (06/22/89)

In article <846@manta.NOSC.MIL> lulue@manta.NOSC.MIL (Dan Lulue ) writes:
>In a modal dialog the user can click the OK button or hit return and the
>OK button will blink.  How does one get this behavior in a modeless
>dialog?  Do I need to get the key down event, figure out that it was the
>enter key, and then toggle the OK button?

Yes you have. It isnd't that much work, now, is it ? Or you can have
the return/enter to post a mouse-down event in the button, and hope to
God that no mouse-downs in between move the window (FlushEvents ?
not a friendly way !)

Or am I missing something, too ?

-- 
 __       Jon W{tte (The dread Smiley Shark) email:h+@nada.kth.se
/  \      (+46 (0) 8 258 268)
   /---   (c) 1989 Yessbox Allright Professional Products Inc. - Y.A.P.P.I.
  /       -- No More --