Keyboard remains visible

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
GoneToSail
Posts: 40
Joined: Sun Jan 24, 2010 10:34 pm
Location: French Atlantic Island

Keyboard remains visible

Post by GoneToSail » Wed Mar 01, 2023 10:19 am

Good morning,
In a mobile app, I need that depending on the user profile, all fields of a given card are editable or not. In order to make these fields not editable when closing this card (and possibly allow modifications only when it will be reopened), I have included something like this in the closeCard script:

Code: Select all

repeat with i=1 to the number of fields of this cd
   set the lockText of fld i to true
   set the traversalOn of fld i to false
end repeat
I thought that this would be enough to hide the keyboard on closing the card. However I find that when some fields of this card have been edited and the user is going to another card (which does not include any editable field), the keyboard remains visible.
How is this possible, and how to obtain that the keyboard disappears when going to another card ?
Thanks for any assistance !

livecode-atc
Posts: 2
Joined: Mon Jan 16, 2023 5:50 pm

Re: Keyboard remains visible

Post by livecode-atc » Wed Mar 01, 2023 3:13 pm

Hi @GoneToSail , try putting focus on nothing after your repeat.
I don't know why it uses the closeCard but personally I like to use the preOpenCard and if you know the name of those fields that cannot be edited. The loop I would use would be something like:

Code: Select all

repeat for each item tFieldName in "field 1, field 2, ...." ---> The name of the fields separated by comma
   set the lockText of fld i to true
   set the traversalOn of fld i to false
end repeat

focus on nothing

GoneToSail
Posts: 40
Joined: Sun Jan 24, 2010 10:34 pm
Location: French Atlantic Island

Re: Keyboard remains visible

Post by GoneToSail » Wed Mar 01, 2023 3:32 pm

Thanks so much !
I did not know that command, and it works fine.
It seems also a good idea to move the "lock" script in preOpenCard.
Regards

Post Reply

Return to “iOS Deployment”