Damn pop up keyboard

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
mvillion
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 107
Joined: Sun Feb 24, 2013 12:29 pm

Damn pop up keyboard

Post by mvillion » Sun Sep 23, 2018 10:55 pm

Hi

I have an app and the pop-up keyboard pops up when it is launched. It makes the app look sloppy.

The card comprises of buttons and three text fields. I do not have any commands that force focus or anything like that. What I want it the card to display and allow the users to focus on the text field when the pop-up keyboard would pop up.

It sounds so simple but there must be something (obvious) I am missing as it cannot 'silence' the keyboard.

Cheers
Matt

AndyP
Posts: 614
Joined: Wed Aug 27, 2008 12:57 pm
Location: Seeheim, Germany (ex UK)
Contact:

Re: Damn pop up keyboard

Post by AndyP » Mon Sep 24, 2018 10:04 am

you could try in the card script

on openCard
focus on nothing
end open card
Andy Piddock
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search

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

Re: Damn pop up keyboard

Post by jacque » Mon Sep 24, 2018 5:51 pm

The behavior has been around since the MetaCard days and is usually more annoying than useful. LC will focus on the first editable field on the card when the card is opened, which on mobile forces the keyboard to display.

The behavior depends on the setting of traversalOn. The workaround is to set the traversalOn of the field to false on preOpenCard and set it back to true after the card is drawn.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

mvillion
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 107
Joined: Sun Feb 24, 2013 12:29 pm

Re: Damn pop up keyboard

Post by mvillion » Wed Sep 26, 2018 7:12 am

As a different approach, I added a card with nothing on it except a JPG to act as the first screen of the stack - becoming the splash screen

I added this code to the card

Code: Select all

on opencard
wait 2 seconds
go to card "Input card"
end opencard
In the IDE it works but when pushed to the iPad, it does not work.

If I put the code into a button on the front screen and push it to the iPad, it works.

Why would the code not execute on the iPad?

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

Re: Damn pop up keyboard

Post by jmburnod » Wed Sep 26, 2018 8:31 am

Hi Matt,
You may try a send in time message (not tested on iOS)

Code: Select all

on opencard
   send "goMyCard 2" to me in 2 seconds
end opencard

on goMyCard pNum
   go to cd pNum
end goMyCard
Best regards
Jean-Marc
https://alternatic.ch

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Damn pop up keyboard

Post by bangkok » Wed Sep 26, 2018 2:31 pm

jacque wrote:
Mon Sep 24, 2018 5:51 pm
The behavior depends on the setting of traversalOn. The workaround is to set the traversalOn of the field to false on preOpenCard and set it back to true after the card is drawn.
You mean :

Code: Select all

on preOpenCard 
set the traversalOn of fld "test" to false
end preOpenCard 

on openCard
set the traversalOn of fld "test" to true
end openCard

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

Re: Damn pop up keyboard

Post by jacque » Wed Sep 26, 2018 6:02 pm

Almost. The card isn't fully redrawn until opencard finishes, so it's more reliable to send a message in time to reset traversalOn.

Code: Select all

on preOpenCard 
  set the traversalOn of fld "test" to false
end preOpenCard 

on openCard
  send "resetFld" to me in 1
end openCard 

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

mvillion
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 107
Joined: Sun Feb 24, 2013 12:29 pm

Re: Damn pop up keyboard

Post by mvillion » Wed Sep 26, 2018 7:16 pm

Ok. This worked. Thanks 8-)

Code: Select all

on preOpenCard 
  set the traversalOn of fld "test" to false
end preOpenCard 

on openCard
  send "resetFld" to me in 1
end openCard 

on resetFld
  set the traversalOn of fld "test" to true
end resetFld
I am still fascinated by why this did not move to the second card.

Code: Select all

on opencard
wait 2 seconds
go to card "Input card"
end opencard
This also did not work

Code: Select all

on opencard
   send "goMyCard 2" to me in 2 seconds
end opencard

on goMyCard pNum
   go to cd pNum
end goMyCard
LC just ignored it entirely when deployed to the iPAD. In the IDE it worked perfectly.
Any ideas? (There is something to learn here..)

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

Re: Damn pop up keyboard

Post by jacque » Thu Sep 27, 2018 9:03 pm

It should have worked, there's nothing wrong with the handlers you posted. Try it in a new test stack with two cards and see if it works there. If so, something else in your scripts is probably interfering. I'd use the second set of handlers, it's usually better to let openCard complete before navigating elsewhere.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Damn pop up keyboard

Post by FourthWorld » Fri Sep 28, 2018 2:39 am

The behavior described comes into play when a LiveCode field has the lowest order number of controls on a card. Good discussion about ways to handle that, but I'm still wondering something more fundamental:

Have you spent enough time attempting to actually edit text using a LiveCode field (as opposed to a scripted OS-native field) on a mobile device to determine if it will be at all satisfactory for your users' needs?

Designed as they are for desktop use, where they meet user expectations very well, most people find the complete absence of common UI support for mobile editing tasks somewhere between cumbersome and disturbing, which is why script access was provided for true OS-native fields.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mvillion
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 107
Joined: Sun Feb 24, 2013 12:29 pm

Re: Damn pop up keyboard

Post by mvillion » Fri Sep 28, 2018 8:33 am

Hi Forthword

I have to say I am not following the conversation.

I dragged a text field from the toolbar, dropped it where I wanted it and there it is.
I don't think I know what you are referring to as OS- Native field. I am aware of Mac Native fields however in all the software I have written, I have just used the standard 'field' tool and it has worked.

Screen placement was critical as the keyboard does take up a lot of space and without planning, it can hide the entry box.

The software is working (and has been). It was just a matter of suppressing the 'traverasalon' field until outside of opencard to get it to work.

M@

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Damn pop up keyboard

Post by bogs » Fri Sep 28, 2018 12:58 pm

Hey Mv,
I *think* he is talking about something referred to in this fund raising campaign -
Stretch Goal 3 – Native Field Widget

LiveCode currently has an extremely extensive cross-platform text field control, however it has a downside in that it doesn’t feel entirely native on mobile platforms – particularly on iOS where copy/paste and other actions use a custom iOS-only user interface. Right now you can create a ‘native’ field control on iOS and Android which present these features, but it’s a very clunky process as you can’t manipulate them like you can all the LiveCode controls you are familiar with.

We will develop a new native field widget that will hook into the native field on each mobile platform...
so apparently there is some way *in code* to create this native control for mobile, instead of picking one off the tools palette, but I wasn't able to find a good source of reference to post as to how to do it. I did find a native scroller lesson, and this on text controls, maybe this will be of some help. :mrgreen:

Apparently there are downsides to these fields/controls as well, since they don't (apparently) behave exactly like you'd expect a regular control to.
Image

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Damn pop up keyboard

Post by FourthWorld » Fri Sep 28, 2018 7:47 pm

How to your users adjust text selection in the field without the selection handles that OS-native fields use? How do your users invoke the standard context menu OS-native fields provide?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “iOS Deployment”