Inserting a character (LC 7.0.1)

Graham Samuel livfoss at mac.com
Sun Nov 2 11:56:06 EST 2014


Suppose a user is keying some characters into a string, and I want to insert an additional character (let's say it's in a variable called 'myChar') by program (from a palette, for example). This is probably very very obvious, but I can't hack it. I can do

  if "field" is in the focusedObject then
      put myChar after the focusedObject
  end if

But of course 'after' ignores the position of the insertion point. I can't see how to bring the insertion point into it. I have tried using 'the selectedChunk', and basically anything with the word 'chunk' embedded in it, but to no avail. The clickLoc I suppose does give coordinates in pixels but it is not really to do with chunks. Really I want it to be possible to script

  put myChar after the insertionPoint of the focusedObject

but there is no such property.

It must be obvious, but I don't see it.

Feeling particularly stupid, even for a Sunday afternoon.

TIA for any advice.

Graham





More information about the use-livecode mailing list