Auto Focus On Edit Field - How To Cancel It

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

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

Auto Focus On Edit Field - How To Cancel It

Post by Googie85 » Tue Aug 27, 2019 11:08 am

Hi Guys!!!

I am trying to launch my app without automatically focusing on an edit field. I have the following code,

on openStack
focus on nothing
end openStack

That does not seem to work. Any ideas would be awesome!

Many Thanks,

Googie.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Auto Focus On Edit Field - How To Cancel It

Post by jmburnod » Tue Aug 27, 2019 12:05 pm

Hi,
You may try "focus on nothing" on opencard.
Best regards
Jean-Marc
https://alternatic.ch

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

Re: Auto Focus On Edit Field - How To Cancel It

Post by jacque » Tue Aug 27, 2019 4:54 pm

I wish there was a switch to turn off this automatic behavior. More than half the time I don't want any field selected when a card opens. There is nothing you can do in any of the pre* or open* messages to stop it, but you can manage it with a workaround.

The traversalOn property controls whether an automatic selection occurs, so turn it off in a preopencard handler and then send a message to turn it back on, if necessary, after the card has completely finished loading.

Code: Select all

on preOpenCard 
  set the traversalOn of fld 1 to false
  send "traversalOff" to me in 10 milliseconds 
end preOpenCard 

on traversalOff
  set the traversalOn of fld 1 to true
end traversalOff
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “iOS Deployment”