Auto Focus On Edit Field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 1
- Joined: Thu Apr 11, 2024 4:55 am
- Location: https://tunnel-rush.io
Auto Focus On Edit Field
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!
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!
Re: Auto Focus On Edit Field
Hi willowherbrestroom,
welcome to the forum!
Try it with a little delay like:
Best
Klaus
welcome to the forum!
Try it with a little delay like:
Code: Select all
on openStack
send "focus on nothing" to me in 10
## if using a "naked" number LC presumes you mean TICKS
## 60 ticks = 1 second
end openStack
Klaus
-
- Livecode Opensource Backer
- Posts: 9443
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Auto Focus On Edit Field
That's much more sensible than what I have done several times:
I have had a 1 x 1 pixel field off-screen and set the focus after that.
I have had a 1 x 1 pixel field off-screen and set the focus after that.
-
- VIP Livecode Opensource Backer
- Posts: 9709
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Auto Focus On Edit Field
Hi.
You will find that adding a short delay will solve issues that otherwise seem perfectly sound. Just because our logic and coding is OK, it does not mean that the physical running of the engine is up to speed with our thinking.
Often you can use a much shorter value than ten ticks. In fact, one tick is more than enough, and zero will probably also do in most cases.
Craig
You will find that adding a short delay will solve issues that otherwise seem perfectly sound. Just because our logic and coding is OK, it does not mean that the physical running of the engine is up to speed with our thinking.
Often you can use a much shorter value than ten ticks. In fact, one tick is more than enough, and zero will probably also do in most cases.
Craig
Re: Auto Focus On Edit Field
I think there might still be issues on mobile (not that I have encountered such in my usage) where not only does the first field take focus, it pops up the virtual keyboard. Hence the single pixel focus trick. Jwack would know.
-
- VIP Livecode Opensource Backer
- Posts: 9709
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Auto Focus On Edit Field
Jwack?
I think she is used to having her name manhandled, but this?
Craig
I think she is used to having her name manhandled, but this?
Craig
-
- VIP Livecode Opensource Backer
- Posts: 7255
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Auto Focus On Edit Field
SparkOut wants to be my brother.
The wait method probably works. I usually set the traversalOn of the card to false on preopencard and set it back to true with a send command at the end of opencard. A millisecond or two is usually enough of a lag.
The wait method probably works. I usually set the traversalOn of the card to false on preopencard and set it back to true with a send command at the end of opencard. A millisecond or two is usually enough of a lag.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Auto Focus On Edit Field
In a similar situation, wait did not work for me - the field would still receive the focus.
In the end I had the traversalOn of the field set to false by default and set to true on tabKey, mouseDown (on locked fields) and openField in unlocked fields; and had then to set it to false on closeField/exitField. A faff, but it worked reliably which no other method really did for me...
Stam
In the end I had the traversalOn of the field set to false by default and set to true on tabKey, mouseDown (on locked fields) and openField in unlocked fields; and had then to set it to false on closeField/exitField. A faff, but it worked reliably which no other method really did for me...
Stam