Just wanted to clarify some of the “fog” around edit fields, providing my point of view
- The history of “better” edit fields for Corona :
First there was a blog post from xdee - http://xdee.net/?p=4
Second was implemented a widget.newSearchField “under the covers” matching the above blog post
Lastly was Rob’s blog post
My own implementation started from the newSearchField design, mostly to match the widget library coding and naming conventions, as well as reuse the 3 slice frames that Corona provides with the default themes for Androids and iOS7/iOS
- Credits
Rob’s blog post does not treat at all replacing the newTextField with a display.newText - this is something I asked him if it would be possible to do in a reply to the thread about his blog post but received no answer and went ahead to implement it and clean it up over the holidays with the immeasurable and dedicated help of Kerem(ksan). I would also like to give all the credit to everyone (including Renato) who submitted and keeps submitting calibration data, bug reports and enhancement suggestions to make this a workable solution for the community. However it should be made clear that I received zero assistance from Corona on this and also that the part from Rob’s blog post that I could have used - namely the font Scaling, simply didn’t work.
- Font scaling “fog”
Rob’s blog post suggests a fontScaling mechanism and before that mpappas had a different implementation. I have tried both and unfortunately they fall short on some devices. In the calibration screen, I output the values of both Rob’s and mpappas’s font scaling factors and everyone can check when they work and when not. Rob’s font scaling doesn’t work on some iPads as well. I would assume there is a fog surrounding the fontScaling issue simply because no one from Corona currently has an answer to it or they would have published it already. As we keep collecting more calibration data, the hope is that we can “reverse engineer” an universal font scaling formula but to this moment such a formula eludes me.
- Corona’s part
Even though implementing an edit field with OpenGL from scratch might be a very time consuming task, there are a couple of things that Corona could do to make widget.newEditField work better
- Fix the display.newText text alignment and word wrapping to match the native.newTextField
- Provide an API to retrieve the zoom factor from the simuator
- Provide a way to send touch events to the native.newTextField , so I can position properly the cursor on the first touch of the fake label
- Provide an event to stop/allow some characters (ala “beforedit”) so I can make the edit field validation without flickering
- Provide a correct font scaling mechanism
- Provide help with their own arsenal of testing devices to contribute to the calibration database
Should we expect any of the above to be addressed by Corona? I didn’t and that is why I expended a significant amount of time and resources trying to implement the best possible solution I could with the current means.
Thanks to everyone that recommended my attempt at solving the newTextField issues. The help and support of the community have been more than I expected and that is where I would like all the credit to go.