On the Mac Simulator, native.setKeyboardFocus(myTextField) doesn't work until you manually click on the textfield?

As the title says, I’ve found that if you create a function which creates a newTextField and then automatically sets keyboard focus to it - it never works in the simulator.

I realise the simulator is not as important as the devices themselves, but for quick testing purposes it would be nice if this worked. Since the newTextFields are quite ugly and can’t go into a display group, I quite often put them off-screen and have a separate newText update as the newTextField is edited/submitted. This means I can’t click them in the simulator, or have to move them on screen when platformName is “Mac OS X”.

It’s not a big problem, I just wondered if it’s something that’s easily fixable. [import]uid: 84115 topic_id: 34200 reply_id: 334200[/import]

+1 on this. [import]uid: 14018 topic_id: 34200 reply_id: 136021[/import]

Hello @AlanPlantPot,
I’m checking into this and should have an answer for you soon. Also, please avoid double-posting issues in the forum, as it makes it difficult to track responses. Thanks!

Brent
[import]uid: 200026 topic_id: 34200 reply_id: 136034[/import]

Ah didn’t realise it had double posted, looks like it went through twice at the same time.
Are you able to delete the duplicate topic please?

Thanks [import]uid: 84115 topic_id: 34200 reply_id: 136035[/import]

Hi again,
No worries, I removed the duplicate post. :slight_smile:

Just so I understand your request: you want to create a native.newTextField and then immediately place keyboard focus on it? If so, I tried it and you’re correct that it doesn’t work if you set the focus immediately after creating the field. However, I got it to work by delaying the focus with a timer by just 10 milliseconds… that “delay until next processor cycle” seems to do the trick. Is this an acceptable solution for you?
[import]uid: 200026 topic_id: 34200 reply_id: 136038[/import]

Oh, that will be fine. I thought it wasn’t set up to work fully in the simulator, I think I can wait 10 milliseconds each time :slight_smile: [import]uid: 84115 topic_id: 34200 reply_id: 136042[/import]

+1 on this. [import]uid: 14018 topic_id: 34200 reply_id: 136021[/import]

Hello @AlanPlantPot,
I’m checking into this and should have an answer for you soon. Also, please avoid double-posting issues in the forum, as it makes it difficult to track responses. Thanks!

Brent
[import]uid: 200026 topic_id: 34200 reply_id: 136034[/import]

Ah didn’t realise it had double posted, looks like it went through twice at the same time.
Are you able to delete the duplicate topic please?

Thanks [import]uid: 84115 topic_id: 34200 reply_id: 136035[/import]

Hi again,
No worries, I removed the duplicate post. :slight_smile:

Just so I understand your request: you want to create a native.newTextField and then immediately place keyboard focus on it? If so, I tried it and you’re correct that it doesn’t work if you set the focus immediately after creating the field. However, I got it to work by delaying the focus with a timer by just 10 milliseconds… that “delay until next processor cycle” seems to do the trick. Is this an acceptable solution for you?
[import]uid: 200026 topic_id: 34200 reply_id: 136038[/import]

Oh, that will be fine. I thought it wasn’t set up to work fully in the simulator, I think I can wait 10 milliseconds each time :slight_smile: [import]uid: 84115 topic_id: 34200 reply_id: 136042[/import]