Page 1 of 1

ReturnInField and selectedChunk

Posted: Mon Dec 17, 2007 11:03 am
by rozek
Hello!

I'm currently facing the following problem: within a "ReturnInField" handler (which gets called whenever a user hits "Return" while the underlying "Field" has the keyboard focus) I'm trying to use "the selectedChunk" to determine the position of the insertion point - but unfortunately, "the selectedChunk" always yields "empty".

Within the debugger, I can see that the handler gets called but "the selectedChunk" does not produce a result. A similar construct within a "BackspaceKey" handler works as foreseen - unfortunately, however, I can't use "ReturnKey" within a "Field"...

Does anybody have an idea how to circumvent this problem?

Thanks in advance for any help!

Posted: Mon Dec 17, 2007 11:47 am
by Mark
Rozek,

What exactly makes you think that the selectedChunk is empty? Try this:

Code: Select all

on returnInField
  put the selectedChunk
  pass returnInField
end returnInField
The debugger makes selections empty because the active line in the debugger is selected. The debugger probably interferes with your script.

Best,

Mark

Posted: Mon Dec 17, 2007 12:30 pm
by rozek
Mark,

that's it! The debugger really made all my experiments with selectedChunk, selectedLine etc. useless - grrr...

Thanks a lot for this important tip!