What was happening is, for instance, if you modified an input slot and immediately clicked on Go, instead of first clicking somewhere else to get the caret out of the input slot, the modification wouldn't take effect and, although the input slot would show the new value, its actual contents would be the old ones. What I've done is telling the caret to notify the input slot that its text has changed:
Code: Select all
method textinput Caret evt keyboard {
char = (at evt 'text')
if ('numerical' == (editRule target)) {
if (not (or (isDigit char) ('.' == char) ('-' == char))) { return }
}
insertRight this char
parent = (parentHandler (morph target))
if (isClass parent 'InputSlot') {
textChanged parent
}
}
So, to handle that, when instantiating a new Caret I'm destroying all the other carets:
Code: Select all
method initialize Caret aText initialSlot {
for c (allInstances 'Caret') {
if (c != this) { destroy c }
}
morph = (newMorph this)
setFPS morph 2
if (notNil aText) {
edit this aText initialSlot
showKeyboard true
}
}
I hope it's useful!