Page 1 of 1
replace char at cursor
Posted: Mon May 25, 2009 1:27 am
by Preston Shea
How does one replace the char at the cursor in a field with the char typed instead of inserting the char typed?
Posted: Mon May 25, 2009 5:20 am
by WaltBrown
From an amateur (me) - this question was a good learning experience
I put this in the field (named "fText") script:
Code: Select all
on keydown theKey
put word 2 of the selectedChunk into afterChar
put theKey into char afterChar of field fText
end keydown
The selected chunk returns "char n to char m of field k" where n (word 2 of selectedChunk) is the character after the insertion point and m (word 4 of selectedChunk) the character before.
I imagine there might be a better way, like a global parameter or field property, but I couldn't find one.
Good luck,
Walt
Posted: Mon May 25, 2009 5:21 am
by WaltBrown
By the way, when I said "From an amateur" I meant me, just to be clear.
insert char
Posted: Mon May 25, 2009 12:25 pm
by Preston Shea
Exactly what I needed. Thanks so much!