How to hide Keyboard
Hi, I'm new to Titanium and i'm tryin to create a calculator app for my own use. the problem is, that none of the default apple keyboards have the buttons i need, so i'm trying to make a custom keyboard layout with buttons.
My Question is now, how can i hide the keyboard though i focus a textfield to have this blinking bar which indicates a selected textfield. When i blur instantly the keyboard, i won't see the keyboard by selecting the textfield, but also my blue blinking bar is gone. So how can i actually block or hide the keyboard with an active textfield?
3 Answers
-
if you're using android, you can call the function:
Ti.UI.Android.hideSoftKeyboard();
for iphone, you can blur the textfield:
textField.blur()
-
###Note: Alloy is being used to give an example, the same approach with different code can be followed in classic too.
If your form has around 20 fields then blurring all fields doesn't seems to be a good idea.
One of the approaches could be to add a hidden textfield to your view. for eg.<View> ...... <TextField id="hidekb" visible="false" height="0"></TextField> ...... </View>
Then use the following code to hide the keyboard:
$.hidekb.focus(); $.hidekb.blur();
Cons: If different textfields are using different kind of keyboards, then it might give an wierd effect of different keyboard being shown before your keyboard is removed.
-
Here is the solution
function amabilidad() { var numero = 0; if(ama1.getBackgroundColor() == '#ff6e00') {numero = 1} else if(ama2.getBackgroundColor() == '#ff6e00') {numero = 2} else if(ama3.getBackgroundColor() == '#ff6e00') {numero = 3} else if(ama4.getBackgroundColor() == '#ff6e00') {numero = 4} else if(ama5.getBackgroundColor() == '#ff6e00') {numero = 5} return numero; }
thanks