Question: How to capture user text input?
How do you recommend we create a "form" to capture user input (like asking for a user name)? I don't think that your thin document model supports form element, and I can't sort out how to bring up the ios keyboard with the hope of capturing keypress events.
Also, this is an awesome framework.
Seems like requests like this are tough, because there are so many useful things like this that could go in Ejecta - but I think if anything like this is incorporated it should be as some kind of plugin or add on or something (kind of like Phonegap does) so that the framework stays minimalist and "pure". So, um, can you just add a plugin framework to Ejecta? Thanks ;)
Agree. I imagine an interface like ejecta.captureText(successCallback, errorCallback) where successCallback is passed the string input. Any thoughts on the API?
I'll see what I can whip up...
Popping up a system alert box (i.e. something like this ) wouldn't be too difficult, but it's not pretty and gives you very limited control.
Maybe we should have something like an invisible <input type="text"> that just pops up the keyboard and supports onchange events etc. Drawing the text the user entered would then be the Apps responsibility. Thoughts?
That would work great for my needs!
What about an UIKit extension? I've started with an implementation of UIScrollView, but definitely starting to see other needs .. UIButton/UILabel/UITextField/etc
I've done the simple thing with the alert box now:
ejecta.getText( 'title', 'subtitle', function(text) {
console.log(text);
});
If the user taps 'cancel', the 'text' parameter in the callback will be an empty string.
@leftright: you could build these yourself in JavaScript and display with Canvas. Native UI may be nice to have, but I want to keep Ejecta simple and not make it a general purpose UI framework. I guess a plugin system for Ejecta, as @mrspeaker suggested would be a good idea.
Why not change "ejecta.getText" to "prompt"
prompt is blocking, while ejecta.getText uses a callback. I'm not really sure how to implement it in a blocking manner; I'd probably have to create the alert box in a separate thread and wait for it. Somehow.
I'll look into it. Having alert() and prompt() instead of custom functions is probably a good idea.
I think these functions should either be blocking or emit custom events to notify the background animation to pause and resume.
I might be a bit late to this thread but we implemented Ejecta into PhoneGap about a year ago. https://github.com/Wizcorp/phonegap-plugin-wizViewManager
We also have an Android version but it is not public yet. If there are requests for this we can publish what we have if people are willing to assist on cleaning it up.
Did you implement an Android version of Ejecta?!
@weepy For some Ejecta Android fun, check out https://github.com/3dseals/Ejecta-X this is not an official Ejecta port as far as I can tell and its pretty buggy, but might be enough if your requirements are not too high. Ejecta-X is not PhoneGap integrated though.
thanks for the hint. I think I'll be waiting a little while and hope Ejecta-X becomes more stable .... ^_^