Page 1 of 1

Damn pop up keyboard

Posted: Sun Sep 23, 2018 10:55 pm
by mvillion
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

Re: Damn pop up keyboard

Posted: Mon Sep 24, 2018 10:04 am
by AndyP
you could try in the card script

on openCard
focus on nothing
end open card

Re: Damn pop up keyboard

Posted: Mon Sep 24, 2018 5:51 pm
by jacque
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.

Re: Damn pop up keyboard

Posted: Wed Sep 26, 2018 7:12 am
by mvillion
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?

Re: Damn pop up keyboard

Posted: Wed Sep 26, 2018 8:31 am
by jmburnod
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

Re: Damn pop up keyboard

Posted: Wed Sep 26, 2018 2:31 pm
by bangkok
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

Re: Damn pop up keyboard

Posted: Wed Sep 26, 2018 6:02 pm
by jacque
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

Re: Damn pop up keyboard

Posted: Wed Sep 26, 2018 7:16 pm
by mvillion
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..)

Re: Damn pop up keyboard

Posted: Thu Sep 27, 2018 9:03 pm
by jacque
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.

Re: Damn pop up keyboard

Posted: Fri Sep 28, 2018 2:39 am
by FourthWorld
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.

Re: Damn pop up keyboard

Posted: Fri Sep 28, 2018 8:33 am
by mvillion
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@

Re: Damn pop up keyboard

Posted: Fri Sep 28, 2018 12:58 pm
by bogs
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.

Re: Damn pop up keyboard

Posted: Fri Sep 28, 2018 7:47 pm
by FourthWorld
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?