[comp.sys.mac.programmer] Fake a KeyDown as MouseDown in Modal Dialog

soe@ames.arpa (Brad Soe) (04/23/88)

I want to know if it is possible to use the filter function 
passed to ModalDialog to take a keydown event, change it to 
a mousedown event, and have ModalDialog process this. I have
a problem where I have two textedit boxes in a dialog. 
I want the dialog to behave in such a way that if the user
hits the return key in one textedit box, the cursor  
automatically goes to the next text box and activates it.  
I have tried to modify: event.where to a point in the
rectangle, set event.what = mouseDown, and 
OrBit(Event.modifiers, 128) (sets the mouse down bit), but
it does'nt seem to work.  Is there a way to do this?


					Brad Soe 
					internet : soe@ames.arc.nasa.gov
					NASA Ames Research Ctr.
					Mail Stop 233-18
					Moffett Field, CA 94035
					(415) 694-4866

darin@Apple.COM (Darin Adler) (04/27/88)

In article <7735@ames.arpa> soe@ames.arpa (Brad Soe) writes:
> I want the dialog to behave in such a way that if the user
> hits the return key in one textedit box, the cursor  
> automatically goes to the next text box and activates it.  

The Dialog Manager routine SelIText allows you to change the
selection in dialog manager editText items. When you see a
return key hit in your filter, you can just call SelIText to
select the next box, then change the event to a nullEvent, so
that the Dialog Manager will not process it.

Alternatively, you can change the value of the key in the event
to Tab, fooling the Dialog Manager into thinking that the user
hit the Tab key, which behaves in the way you describe it.
-- 
Darin Adler						AppleLink:Adler4
UUCP: {sun,voder,nsc,mtxinu,dual}!apple!darin	  CSNET: darin@Apple.com