ReturnInField and selectedChunk

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
rozek
Posts: 151
Joined: Mon Jun 19, 2006 2:29 pm
Location: Böblingen, Germany
Contact:

ReturnInField and selectedChunk

Post by rozek » Mon Dec 17, 2007 11:03 am

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!
Kind regards,

Andreas Rozek

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Dec 17, 2007 11:47 am

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

rozek
Posts: 151
Joined: Mon Jun 19, 2006 2:29 pm
Location: Böblingen, Germany
Contact:

Post by rozek » Mon Dec 17, 2007 12:30 pm

Mark,

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

Thanks a lot for this important tip!
Kind regards,

Andreas Rozek

Post Reply

Return to “Talking LiveCode”