Hey, this actually worked like a charm! Excellent work! If you had known how long I have been struggling with this and getting nowhere with Corona…
Please provide me with an email address (PM if you prefer) so that I can PayPal you a $15 donation.
Hey, this actually worked like a charm! Excellent work! If you had known how long I have been struggling with this and getting nowhere with Corona…
Please provide me with an email address (PM if you prefer) so that I can PayPal you a $15 donation.
Testing the app in iOS worked very well. Testing on an Android device, not so good. It immediately crashes with this message:
It seems just this line is enough to crash my Android (8.0) device (Samsung Galaxy S9):
local keyboardEvents = require("plugin.keyboardEvents")
This is not normal?
According to the Marketplace entry, this is an iOS only plugin but I’ll let @ojnab confirm that.
Rob
My apologies.
I have never used platform-specific plugins before. Actually I didn’t know it was even possible/legal.
And it never occurred to me that a require call to a plugin (that is not made for the current platform) could downright crash an app like that. This is a very ungraceful way of handling it IMHO. I was certain that in worst case it would return nil so that it could be handled properly.
But I learn new things every day…
A least now it works (after checking the platform before even doing the require call)!
Rob is right - it is iOS only.
Anyway it shouldn’t crash Android since I added an Android stub file to the repo.
The Android stub file is supposed to get downloaded in order to gracefully handle the missing Android functionality.
I am not sure what went wrong…
For now - to prevent Android crashes you can just create your own stub functions like this:
local keyboardEvents if system.getInfo("platform")=="ios" then keyboardEvents = require "plugin.keyboardEvents" else keyboardEvents = {} keyboardEvents.setTextFieldAutocapitalizationType = function() end keyboardEvents.setTextBoxAutocapitalizationType = function() end end
Ok thanks, I have made a common KeybSett() utility function (called after each newTextField()) and handled it more or less like this:
local keyboardEvents = nil if (onIOS() == true) then keyboardEvents = require("plugin.keyboardEvents") keyboardEvents.init() end KeybSett = function() if (onIOS() == true and keyboardEvents ~= nil) then keyboardEvents.setTextFieldAutocapitalizationType("None") keyboardEvents.setTextBoxAutocapitalizationType("None") keyboardEvents.setAutocorrectionType("UITextAutocorrectionTypeNo") keyboardEvents.setSpellCheckingType("UITextAutocorrectionTypeNo") end end
Maybe not so elegant, but it seems to do the job.
Yes it will.
Also you only need to do the keyboardEvents.init() call if you want to listen for keyboard events.
And by the way donations will not be necessary, but thanks for the offer :)
Ok, thanks a bunch then
We have a feature request for this:
But it only has 51 votes on it. While it seems like it should be a no-brainer, we still have to prioritize it with all the other work we have going. We only have limited engineering hours and you (the community) have a long list of requests. Encourage more people to vote for this.
Rob
Thanks Rob. I will vote for it
Hi Rob,
Yes, I’ve already voted.
I’m a software developer in a larger organisation, we also have a fairly large support/request queue. From France alone it’s above 22000 now…
Point is, I’m familiar with how a request queue works. We have an in-house practice, however: if it’s an obvious thing (which will benefit many customers) and if it’s easy/fast to implement, we simply just do it. Maybe it’s a stupid thing to, but we’re doing quite well so it’s at least not a company destroying practice…
Just saying…
It’s just so damned embarassing to not be able to do this obvious thing. I have a really hard time defending behavior this to the users.
Not to mention the feature request was back in 2013.
I have a simple system for feature requests in my games… I have 3 folders in Outlook (per game) called “easy”, “medium” and “hard” and that roughly translates into “hours”, “days” and “weeks”.
The problem with the current “get x votes before we look at it” systems means that often easy wins like this just get ignored.
Agree.
I’m asking engineering about it. It can’t be implemented in a cross-platform way. If we did, it would be iOS only. I believe as a community, you would likely be happy with this being an iOS-only feature.
Rob
Well, since it’s an iOS only problem (at last it is for me), an iOS only feature is completely ok by me.
Rob, did you get any answers from the engineering about the feasibility of this?
They said, there are cross-platform issues with it. I said the community would appreciate it even if it was iOS only. Right now Engineering’s workload is full with must-do projects and this is something I’ll need to bring back up at some point in the future.
Rob
Ok, thanks for the effort anyway, Rob!
I just added the option to set autocapitalizationType on native text fields and text boxes (iOS only) using this plugin:
https://marketplace.coronalabs.com/corona-plugins/keyboard-events
Do like this:
local keyboardEvents = require "plugin.keyboardEvents" -- Call this for text fields keyboardEvents.setTextFieldAutocapitalizationType("None") -- Call this for text boxes keyboardEvents.setTextBoxAutocapitalizationType("None")
Both methods takes one of the following options: “None”, “Words”, “Sentences” or “AllCharacters”
The autocapitalization type will be set on all instances of text boxes or text fields in your app.
If you need different autocapitalization types on different text fields you can switch the type in the began phase of the individual textInputListeners.