Cursed by insertions

J. Landman Gay jacque at
Sun Feb 27 16:30:47 EST 2011

On 2/27/11 2:12 PM, Peter Haworth wrote:
> I think Richmond is referring to the insertion point, not the cursor.

He says no, but you've brought up a related issue.

> I have noticed this before - if you place the insertion point
> somewhere in an LC control, switch to another application, then
> switch back to LC, the insertion point is gone.  This is on a Mac.
> Other applications on the Mac don't act this way, they show the
> insertion point where it was last time you were in them.

There's an automatic behavior when a card opens or resumes: the engine 
sets the focus to the first control with traversalOn set to true. This 
has happened since day one, and mostly I find it annoying, and it 
requires work-arounds. On Windows, where buttons can have traversal, the 
first control may be a button. On Mac, the first control is always the 
first editable field (even though OS X lets you set up keyboard 
navigation through buttons.)

The only workaround I know of is to store the selectedChunk on 
suspendStack and restore it on resumeStack.

> The dictionary description of the selectedLoc seems to imply it
> refers to the top left coordinates of any selected text - does it
> work if there is no text selected but you need to find out where the
> insertion point is?

The selectedloc assumes there is an active selection, and is only used 
to find the physical x,y coordinates on screen. If you only need to find 
out where the insertion point is, use "the selectedChunk". That gives 
you a field and character reference. If the insertion point is not 
placed, the selectedChunk is empty.

Jacqueline Landman Gay         |     jacque at
HyperActive Software           |

More information about the Use-livecode mailing list