iOS Question [B4xPages] Keyboard Event Issues - B4i differences?

MrKim

Well-Known Member
Licensed User
Longtime User
I am finishing up my first B4xPages app and on testing have some questions about keyboard and differences in the B4i version. I have read a lot of posts but they stretch over time and I am never sure if they apply to B4X/B4Xpages or just the the particular compiler. Also let it be known that I am an Android user, and bought an iPhone for the sole purpose of development so I am not really familiar with how things are 'supposed' to work in the iPhone world. Also, I have never tried designing an iPhone app using B4i specific controls (Controls were all copied from Android designer and are all dimmed as B4Xviews.).
So,
1. In B4A the controls are "pushed up" just fine when the keyboard is displayed in the iPhone version this does not happen. Is this a bug? By design? Have I missed something? If this is the way it works what is the recommended way to handle this?

2. It appears that in B4J/B4A the _TextChanged (Old As String, New As String) event fires when I 'stuff' text in the view in code (a blessing and a curse). In B4i it does not appear to fire when 'stuffing text' in code. Is this a bug or is this the normal behavior? I ask because I have code that I need to run when text changes, but I also don't want it to run twice. So do I need to code it differently for B4i? I will give you and example: The user can select text from one location and it is then copied to another location where they can edit it. The text selected may or may not be too long for the field. If it is too long a warning is given and the text returned to Old. The code HAS to be in the event to handle the user edits and that works fine in B4J/A/i but it appears that for B4i I will have to put the code separately for the copy?

3. I have a page with several EditTexts/TextFields. In the 'Tab' order they are alternating input types. One is regular ASCII input followed by one set to Phone input followed by EMail, then Phone2. (Android designer Input Type is TEXT/PHONE/TEXT/PHONE. In B4i it is DEFAULT/PHONE_PAD/EMAIL_ADDRESS/PHONE_PAD) Again, works fine in Android I get the little arrow that takes me to the Next field. In B4i I have all the fields set to Return Key = NEXT and the final one set to DONE. In ALL cases NEXT closes the keyboard and the cursor disappears so I have no idea where I am. I have to manually select every field to edit it. AAANDD! The PHONE_PAD keyboard has NO Return/Next/Done button so there is no way to move anywhere anyway which brings me to # 4.

4. On other iPhone apps swiping down from the top of the keyboard closes the keyboard. My B4xPages app does not appear to support that behavior. So there appears to be NO WAY to close the keyboard. Since the last field is PHONE and has no "Return Key". The only way I have found to close the keyboard is to Pick another View that HAS a "Return Key" and then click that. I have another page that has a TextView (A lot of editable text-needs to scroll) rather than a TextField and it has no "Return Key" behavior property that I can find and I have found no default way to close the keyboard. I was able to cobble something together using Sub B4XPage_KeyboardStateChanged and the Sub TextView_Click event but it is not intuitive.

5. The TextView appears to require a Double Tap to open the keyboard rather than one tap as with a TextField? Is this normal behavior?Very non-intuitive to have two different ways of getting the Keyboard.

As always, I feel like I have somehow missed an important piece of the puzzle.

As always thanks for any help and ideas.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Is this a bug?
No.

By design?
Apple design.

If this is the way it works what is the recommended way to handle this?

Note that in complex apps it is not always best to rely on Android built-in panning feature. You can handle the keyboard changes yourself with IME library.

t appears that in B4J/B4A the _TextChanged (Old As String, New As String)
True. This is how the native event behaves. I recommend you to switch to B4XFloatTextField. The event will behave the same.
I always use B4XFloatTextField in cross platform projects, even if the floating hint is not needed.

Another option is to raise it yourself:
B4X:
If xui.IsB4i Then EditText1_TextChanged("", EditText1.Text)

4. On other iPhone apps swiping down from the top of the keyboard closes the keyboard
You are responsible for closing the keyboard yourself in iOS. You can do it with B4XPages.GetNativeParent(Me).ResignFocus.

5. The TextView appears to require a Double Tap to open the keyboard rather than one tap as with a TextField? Is this normal behavior?Very non-intuitive to have two different ways of getting the Keyboard.
You are seeing the OS native behavior.
 
Upvote 0
Top