Thank you everybody for those suggestions, which I have been trying to incorporate. But it’s slightly more complex than I let on originally.
It is a Mac Desktop crossword app and there is a set of textfields, only visible from 1 to the length of the word required. The first textfield has the focus. All the cells are blank unless a crossing solution has been entered in which case the appropriate cell has the appropriate letter. So the line could read something like
_ _ _ P _ R _ G _ _
Ideally, I would just start typing, then look up to check I hadn’t made any errors, then click on the Accept button. But if I had made errors, I would need to start again or go back to the first mistake by using the shift tab or by clicking and then try to type more carefully.
Of course there are no restrictions on the letters to go into the blank squares but the letters already entered if any, should not be changed.
My best solution so far is a keydown event as follows. I’m sorry, I’ll try, but I’m not sure how to format it as code.
> dim t,ch as string
> dim r, c, length, d, i, n, m as integer
> r=arr_tNums(1)//don’t worry about this
> c=arr_tNums(2)//don’t worry about this
> length=arr_tNums(3)//don’t worry about this
> d=arr_tNums(4)//don’t worry about this
> m=me.index//m for me
> n=m+1//n for next
> t=key
> ch=t.Uppercase
> me.text=ch//keyed-in letter, in caps, goes into the textfield whatever
> if arr_tBuild(m+20)="0" or arr_tBuild(m+20)=""then//no problem as no crossing letter exists
> arr_tBuild(m)=ch.Uppercase//letter goes into a backup array
> tf(n).SetFocus//focus to next textfield
> else//must be a required letter in this cell
> ch=arr_tBuild(m+20)//get it from backup
> me.text=ch//and put it in cell whatever the keydown was
> tf(n).SetFocus//move focus on
> end
But unfortunately, as soon as I start typing, the capitalised letter appears in the appropriate cell but the lowercase letter entered on the keyboard appears in the next cel as well. This is overwritten by the next letter typed, but it is sloppy and it annoys me. Also, if I make a mistake and have to start again, I get various different annoying problems.
I’ve spent at least a day on it now and everything I try has the same problems, so any suggestions would be very welcome. Nearly 1am in the UK so am going to bed now. Thanks, good night! - Steve