Page 1 of 1

Forcing a return/Carriage Return

Posted: Wed Sep 01, 2010 2:29 pm
by arkstar
I have a stack where the user can edit a message before sending off an email.
If the user hits the return key, it sends off the message. I would like pressing the return key to generate a linefeed or CR

I have used this code:

on returnInField
put return after me
end returnInField

This code does works but it sends the cursor to the bottom of the window and not to the next line.....

Any ideas?

Thanks
Rob

Re: Forcing a return/Carriage Return

Posted: Wed Sep 01, 2010 3:17 pm
by dunbarx
I am not sure what distinguishes the two operations. But does this do what you want?

Code: Select all

on returnInField
   select after line word 2 of the selectedLine of me + 1 of me
end returnInField
You mentioned that you wanted to go to the next line. The previous script does that. But it does not add a return. If you want that:

Code: Select all

on returnInField
    put return after line word 2 of the selectedLine of me of me
end returnInField
And I assume that the mail is sent in another line of code somewhere.

Re: Forcing a return/Carriage Return

Posted: Wed Sep 01, 2010 3:27 pm
by Klaus
Hi arkstar,

you trigger a command/handler on RETURN in that field right?
But this is not in your "returninfeld" handler? So how do you do this?

Whatever, you could do this:

Code: Select all

on returnInField
  send "the_handler_that_needs_to_be_triggerd" to this stack in 1
  pass returninfield
end returnInField
This will wait 1 tick (= 1/60 second) before the action takes place,
so time enough for the field to put that CR automatically at the right place! :D
Know what I mean?


Best

Klaus

Re: Forcing a return/Carriage Return

Posted: Wed Sep 01, 2010 4:05 pm
by arkstar
Thanks guys for the FAST responses!

I used dunbarx's code and it worked perfectly!

Thanks so much!

Rob
(arkstar)