control array and tabbing to next

I have an array of textareas. I also have code in its lostfocus, which cleans up that textarea. Lostfocus doesn’t of course fire until after the focus has moved.
Part of that code is to change focus by tabbing to the next control. For some reason I get syntax error when I try the last line in keydown.

If key = chr(9) then me(index) = index + 1 me(index).setfocus return true end if
The line is made by autocomplete, so grammatically is it correct? what’s wrong?

Your array of TextAreas is a ControlSet, not an array. You therefor can not be sure that the indexes are consecutive.

Use the FocusNext() function of the window instead. There is also a FocusPrevious() function.

Your array of TextAreas is a ControlSet, not an array. You therefor can not be sure that the indexes are consecutive.

Use the FocusNext() function of the window instead. There is also a FocusPrevious() function.

That may be. In any case controlset, focusnext, or focusprevious there is no documentation on what they do and don’t do or examples even in the forum. Am I the first to ask?
How am I to ensure to ensure that it goes to the next member of the set and not another control on the window. I should need to use index and this also doesn’t work

Self.me(index).SetFocus

Granted Self.FocusNext does work.
I also am pretty terminology has changed in 4 years in that it was a control array.

Documentation: Window.FocusNext

Xojo Blog:Tab Order Change in Real Studio 2012r1

I think I’ll post a documentation bug. It’s not referenced in control.index.
Thankyou for letting me know it was formally changed and when.

How do I get to textarea(index) = 0?

Not sure what you’re even asking. Your original code

me(index) = index + 1

makes no sense at all. What are you trying to accomplish?

Have you tried TextArea1(0).SetFocus

BTW, SetFocus within the LostFocus event usually doesn’t work. Put your SetFocus code in a short-period timer that you start from LostFocus.

Sorry. I am in Keydown. I found out that focusnext only works for the controlset. In other words it doesn’t apparently go outside of the set, so I wanted to tab back to 0. I’ve tried me(0).SetFocus in keydown, but that gives me a syntax error. I also tried setting the focus outside of the set but that doesn’t seem to work either. Maybe it’s time for a beep. Suggestions.

Use the controlset name instead of “me”. Eg., TextArea1(0).SetFocus. “Me” is already resolved down to an individual control and no longer represents the entire set. I don’t have any experience with FocusNext, so I can’t help you there.

Edit: FocusNext should have nothing to do with index or controlset. Have you set the tab order for all the controls on the window?

Thanks. I wasn’t sure why it wasn’t working. Replaced the ‘me’ with the control’s name and index and it works.