Keyboard Focus On Startup.

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Googie85
Posts: 199
Joined: Tue Aug 05, 2014 10:07 am

Keyboard Focus On Startup.

Post by Googie85 » Fri Dec 16, 2022 9:09 am

Hi Guys!!

I am trying to close the Android keyboard on startup. It focuses on a Field automatically upon the App startup. I have tried:

On openStack
"focus on nothing"
End openStack

I have also set the focus on other images to try and disable the keyboard.

Any suggestions on what I could do to remove the keyboard on startup?

Many Thanks,

Googie.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7228
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Keyboard Focus On Startup.

Post by jacque » Fri Dec 16, 2022 7:29 pm

That's made me crazy since MetaCard and I think there's a bug report about it. For now, you have to implement a workaround. The field selection is the very last thing that happens after the card is fully rendered so trying to fix it in preOpen* anything won't work.

I usually set the traversalOn of the field to false in preOpenCard and send a message to set it back to true in a few milliseconds, which assumes the card will be fully rendered by then. This works if there is only one editable field but if there are more, the next one will be activated instead. You can loop through them all if necessary.

If you're on a Windows machine you can put a button at layer 1 and if its traversalOn is true, that will be activated instead (or it used to be, I haven't tried it in years.) Buttons don't trigger the keyboard. But that doesn't work on Macs so I don't use it. I expect it won't work on mobile either.

BTW, turning off autofocus also fails.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Android Deployment”