Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (keyboard)
Viewing all 352 articles
Browse latest View live

How much time does it take for a keyboard to popup/hide?

$
0
0

I have animation for view moving when a keyboard shows/hides. I was trying to synchronize the animation with the time it takes the keyboard.

  1. Is the time same on Android/IOS?
  2. Dose it take same time for all Androids?
    var userNameTextField = Ti.UI.createTextField({
                borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
                color: '#336699',
                top: 219, left: 10,
                width: 250, height: 60,
                editable: false
            });
     
            startWin.add(userNameTextField);
     
     
            userNameTextField.addEventListener('click', function() {
                userNameTextField.editable=true;
                var animation = Titanium.UI.createAnimation();
                animation.duration = 100;
                animation.top = -50;
                startWin.animate(animation);
                userNameTextField.focus();
            });
     
            userNameTextField.addEventListener('return', function(e) {
                var animation = Titanium.UI.createAnimation();
                animation.duration = 100;
                animation.top = 20;
                startWin.animate(animation);
            });

Toolbar issue in text field with numpad

$
0
0

I have textfield with numpad. I want to show done button on top of numpad and want to hide numpad when I click done button.

XML

<Alloy>
    <Window id="AddTransafer" title="" fullscreen="false" modal="true"  barImage="Images/IPhone-retina_Header01.png" backgroundImage="Images/IPhone-retina_02.png" backgroundRepeat="false" onClick="closeNumPad" 
        onFocus="loadDetails">
        <TitleControl>
            <Label id="titleControl" color="white">MAKE A TRANSFER</Label>
        </TitleControl> 
        <ScrollView contentWidth= "auto" contentHeight= "auto" showVerticalScrollIndicator= "true">
 
    <
 
            <TextField top="290" width="527px" height="73px" id="inputAmount" hintText="Enter Amount" keyboardType="Ti.UI.KEYBOARD_NUMBER_PAD" width="527px" height="73px" borderStyle="Titanium.UI.INPUT_BORDERSTYLE_NONE" backgroundColor="#ffffff" paddingLeft="5"/>
        </ScrollView> 
</Window>
</Alloy>
CS
function loadDetails(){
    initiateAmount();
    // rest of the logic .. 
 
}
function initiateAmount(){
    var doneButton = Titanium.UI.createButton({    
        title : 'Done',
        width : 67,
        height : 32
    });
 
    doneButton.addEventListener('click', function(e) { 
        $.inputAmount.blur(); 
    });
    $.inputAmount.keyboardToolbar = [doneButton];
    $.inputAmount.addEventListener('focus', function(e) {
        $.inputAmount.keyboardToolbar = [doneButton];
    });
}
The problem is that when I click first its appearing like this. When I double clicking its working fine. It has also issues when I press done and click on field again. I am attaching the screenshot for the reference.

alt text

Keyboard won't show on input focus in webview on Android

$
0
0

The keyboard won't popup when tapping an input field in a webview, which contains a simple login form. It works in the emulator, but not on my device (galaxy s2).

Device: Android

SDK: 3.0.0.GA, Runtime: V8, Studio: 3.0.0.201212131639

The project is based on a single window application, commonjs structure.

code:

var win = Ti.UI.createWindow();
var webview = Ti.UI.createWebView({
  url : 'http://www.domain.com/page.php'
});
win.add(webview);
win.open();
I tried adding softKeyboardOnFocus ( Titanium.UI.Android.SOFT_KEYBOARD_SHOW_ON_FOCUS and Titanium.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS ) without any luck. Also, no errors in the console.

Any idea?

Create a scrambled keyboard

$
0
0

Hi, I want to create a login form, where pin code is only numeric and safe. So i want to create a scrambled keyboard but don't know how to do it, and after searching, don't find how to.

I need a 5x2 keyboard.

So if someone can't help me.

Soft keyboard move up entire window

$
0
0

Hi guys, I'm working on comment system like the one in Facebook app, I've got a tableView, a scrollView and an input TextField. Every time I click on my textField and keyboard appears, my entire window lifts up :( Here my code and two images.

Image 1 Image 2

Hope someone will help!

function ChatWindow(id_poi,title) {
    var _this = this;
    this.title = title;
    this.id_poi = id_poi;
 
    this.window = Ti.UI.createWindow({
        title: "Commenti",
        fullscreen:false
    });
 
    this.window.windowSoftInputMode = Ti.UI.Android.SOFT_INPUT_ADJUST_PAN;
 
    this.window.addEventListener('android:back', function() {
            this.close();
    });
 
    this.window.activity.onCreateOptionsMenu = function(e) {
        var actionBar = this.window.activity.actionBar; 
        actionBar.displayHomeAsUp = true;
        actionBar.onHomeIconItemSelected = function () { 
            this.window.close();
        }; 
    };
 
    this.downloadData(this.window,id_poi);
 
    return this.window;
}
 
ChatWindow.prototype.downloadData = function(window,id_poi) {
    this.window = window;
    this.id_poi = id_poi;
 
    var commentReq = Titanium.Network.createHTTPClient();
    commentReq.open("POST","http://www.giacomomarangoni.com/log/comments.php");
    var params = {
        id_poi: id_poi
    };
    commentReq.send(params);
 
    var response;
 
    commentReq.onload = function(){
        var json = this.responseText;
        response = JSON.parse(json);
        configureWindow(window,response);
    };
 
};
 
function configureWindow(window,response) {
 
    this.window = window;
    this.response = response;
 
    var larghezza_schermo = Ti.Platform.displayCaps.xdpi;   
 
    var data=[];
 
    //la tabella probabilmente deve essere messa in una scrollview perchè altrimenti se compare la tastiera non si vede la parte superiore
    var TheTable = Titanium.UI.createTableView({
        rowHeight: 'auto',
        height:'auto',
        top:0
    });
 
    for (var i = 0; i < response.length; i++) {
        var row = Titanium.UI.createTableViewRow({
            height: 'auto', 
        });
 
        //eventuale foto profilo
        /*var profile =  Titanium.UI.createImageView({
            url:response[i].profile_pic,
            width:32,
            height:32,
            left:4,
            top:8
        });*/
 
        var name = Titanium.UI.createLabel({
            text:response[i].nome_completo,
            font:{fontSize:16,fontWeight:'bold'},
            width:'auto',
            textAlign:'left',
            top:8,
            left:10,
            height:'auto',
        });
 
        var comment =  Titanium.UI.createLabel({
            text:response[i].commento,
            font:{fontSize:14,fontWeight:'bold'},
            width:'auto',
            textAlign:'left',
            bottom:10,
            top:28,
            left:10,
            right:10,
            height:'auto',
        });
 
        //row.add(profile); serve per aggiungere la foto profilo
        row.add(name);
        row.add(comment);
        row.className = 'comment_row';
 
        data.push(row);
    }
 
    var scrollView = Titanium.UI.createScrollView({
        contentWidth:'auto',
        contentHeight:'auto',
        top:0,
        showVerticalScrollIndicator:true,
        showHorizontalScrollIndicator:false
    });
    window.add(scrollView); 
 
    TheTable.setData(data);
    scrollView.add(TheTable);  
 
        var textField = Titanium.UI.createTextField({
        color:'#336699',
        height:40,
        left:0,
        width:larghezza_schermo-25,
        bottom:0,
        hintText:'Inserisci un commento',
        keyboardType:Titanium.UI.KEYBOARD_DEFAULT,
        returnKeyType:Titanium.UI.RETURNKEY_DEFAULT,
        borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
    });
 
    scrollView.add(textField);
 
    var sendButton = Titanium.UI.createButton({
        title:'Invia',
        width:60,
        height:40,
        borderRadius:1,
        bottom:0,
        right:0,
        font:{fontFamily:'Arial',fontWeight:'bold',fontSize:16}
    });
    scrollView.add(sendButton);  
};
 
module.exports = ChatWindow;

keyboard launch automatically without focus textfield

$
0
0

Hi,

I had a simple windows, with a view and a textfield in the view. But when the textfield was selected, the keyboard hid the textfield and i didn't see what i wrote.

I found a solution:

i now have my windows and a scrollview which contain everything (so my view, and the textfield inside my view)

But now when the windows is call (win.open();) the keyboard is automatically aunch at the same time....bad thing.

Any idea of how hide the keyboard? (i only want the keyboard if i click on my textfield)

How to prevent auto resizing Window when softkeyboard appear?

$
0
0

Hi all,

I has a Window nad TextField inside it. every i open the Window. the soft keyboard pop up and it make the Window is resized. my question is How to prevent auto resizing Window when softkeyboard appear? Please help

How to import a Ti keyboard shortcuts csv?

$
0
0

You can click Titanium Studio -> Preferences -> General -> Keys, and change the keyboard shortcuts for almost any command. Then you can click the Export CSV button to capture all your custom shortcuts.

Question: If I send this CSV file to another Ti user, how do they import the file? I don't see any option in Ti to do this.


Decimal Keyboard type with ponctuation

$
0
0

I need to have a texfield with a keyboard that has only numbers and a point key. I tryed to use Titanium.UI.KEYBOARD_NUMBER_PAD Titanium.UI.KEYBOARD_NUMBERS_PUNCTUATION Titanium.UI.KEYBOARD_PHONE_PAD and Titanium.UI.KEYBOARD_DECIMAL_PAD all of them showed the same Keyboard, numbers with small alphanumeris (ABC,DEF...) and a Sym key that show the puctuation, slash, +, - and others.

Titanium: 3.2.0 with Alloy Platform: Android 4.3.3 Windows 8.1

Thanks.

Android Keyboard Glitch

$
0
0

I am having an issue with the android version of a Titanium application. On iOS it works fine.

In the second window view when we click to enter a value in the following text field the keyboard will quickly appear and disappear again multiple times in a "glitchy". Then the keyboard will become stuck and even upon closing the application.

I have not been able to find any similar issues during internet searches.

if(isAndroid){
    var entry = Titanium.UI.createTextField({
        color: '#000000',
        backgroundColor: '#FFFFFF',
        keyboardType: Titanium.UI.KEYBOARD_NUMBERS_PUNCTUATION,
        returnKeyType: Titanium.UI.RETURNKEY_DONE,
        softKeyboardOnFocus: Titanium.UI.Android.SOFT_KEYBOARD_SHOW_ON_FOCUS,
        top: "9%",
        left: "1%",
        width: "49%",
        height: "12%",
        textAlign: 'left',
        font:{fontSize:"20%",fontFamily:'Roboto-Light', fontWeight:'bold'},
        hintText: 'Enter value'
    });
}

Titanium 3.2.3 causes unwanted soft keyboard in Android WebViews

$
0
0

I have an Alloy app built using Ti 3.2.2.GA that works well in all tested versions of Android. It includes windows that contain WebViews.

Upgrading to use Ti 3.2.3.GA, on Samsung phones (and possibly others), opening any window that contains a WebView causes the soft keyboard to appear. Any combination of the following does NOT hide the keyboard:

Ti.UI.Android.hideSoftKeyboard();
    $.details.softKeyboardOnFocus = Ti.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS;
    $.details.softKeyboardOnFocus = Ti.UI.Android.SOFT_KEYBOARD_HIDE_ON_FOCUS;
Reverting to Ti 3.2.2.GA solves the problem.

Any ideas?

UI Picker and keyboard cause app crash...

$
0
0

Hi guys, I have a problem with the UI date picker and the Keyboard: If the user doesen't confirm the suggestion and touch the date picker with the keyboard opened the app crash. If he confirm the suggestion date picker is shown correctly. Can I fix this? How can I turn off suggestions or hide the keyboard when the user touch the date picker?

KeyboardToolBar at right.

$
0
0

Hi guys I have one keyboardtoolbar button ,but its show at left of screen. I want to do at right of screen

var send = Titanium.UI.createButton({
    title :'Send',
    right:10,
    style : Titanium.UI.iPhone.SystemButtonStyle.DONE,
});
 
var textField = Ti.UI.createTextField({
  borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
  color: '#336699',
  top: 320, left: 4,
  width: 300, height:40,
  keyboardToolbar : [send],
  clearOnEdit:true,
  clearButtonMode :Titanium.UI.INPUT_BUTTONMODE_ALWAYS,
  keyboardToolbarColor : 'transparent',
  keyboardToolbarHeight : 30,
});

Hide soft keyboard for android and ios

$
0
0

Hi guys,

If you would like to know how to hide soft keyboard in android and ios:

signUpView.addEventListener('click',function(e){
     if(Ti.Platform.osname == 'android'){
          if(e.source.toString() != '[object TextField]'){
               Ti.UI.Android.hideSoftKeyboard();
          }
     } else {
          if(e.source != '[object TiUITextField]'){
               textField.blur();
          }
     }
});
please let me know if you guys have a better method.

Thank You

Possible to do a textArea.focus to a specific character position?

$
0
0

I have a textarea and with the click of a button I can successfully have the textarea focus (and have the keyboard popup), but it focuses to the the last character of the current textArea.value.

Is it possible to have it focus to a specific character position of my choosing?


Keyword related event

$
0
0

hello all, i am implementing a text area and i need to add event listener on that text area when a key[ENTER] is pressed from hardware side. is it possible for me to do that because i dont found any resource regarding this.thanks

How to auto open keyboard when window opens

$
0
0

Am using 3.2.2 SDK, Alloy and Android 4.0. When a windows opens I need to open soft keyboard. I tried focus() in setTimeout() and so on all dint worked for me but if I place a list view its opening but I need to open keyboard without list view.

test.xml

<Alloy>
    <Window id="test">
        <View id="container">
            <TextArea id="text"></TextArea>
        </View>
    </Window>
</Alloy>
test.tss
"#test": {
    width: Ti.UI.FILL,
    height: Ti.UI.FILL,
    navBarHidden: true,
    softKeyboardOnFocus: Ti.UI.Android.SOFT_KEYBOARD_SHOW_ON_FOCUS
}
"TextArea": {
    width: Ti.UI.FILL,
    height: '50dp'
//  softKeyboardOnFocus: Ti.UI.Android.SOFT_KEYBOARD_SHOW_ON_FOCUS
}
I have tried placing TextField also but dint worked. But too many posts that keyboard opening automautically. Its weird.

Android - Avoid keyboard opened by default on a webview on SDK 3.2.3 GA

$
0
0

Hi, I updated my Android app for SDK 3.2.3 GA. The problem is relative the "auto" open of the keyboard on every webview. I would like open the keyboard only when the user focus it; and not at the load of the webview. How can I fix this problem?

This event happen when i try the app on the device.

Webview opens keyboard on Android

$
0
0

Hi All

I am using a webview to load a large image because imageview just doesn't work with large images.

Here is my setup for the window.

exports.create = function(model) {
 
    var self = Ti.UI.createWindow({
        fullscreen : false,
        navBarHidden : true,
        backgroundColor : '#fff'
    });
 
    var imageViewer = Titanium.UI.createWebView({
        top : '60dp',
        enableZoomControls : false,
        height :'80%',
        width : '100%',
        html : '<head></head><body marginwidth="0" marginheight="0"><img style="max-width:100%;text-align: center;" src="http://onairaustralia.com/test_site/wp-content/uploads/2013/08/Download-Hd-Dj-Music-Dance-Composer.jpg" /></body>'
    });
 
    self.add(imageViewer);
 
    return self;
 
};
But every time this window loads it opens the keyboard which seems a bit odd!!!

Has anyone got a solution for this or has experienced this before?

Thanks

Keyboard and empty TableView crashes app on iOS 7.1

$
0
0
  • Titanium SDK: 3.2.3.GA, OSX 10.9.3
  • Platform: iOS 7.1
  • Device: iOS Simulator, iOS Device

My problem is as follows: I got TableView with header view and search field inside the header. When table view is completely empty and i try to focus on text field, the app crashes with:

[ERROR] :  The application has crashed with an uncaught exception 'NSInternalInconsistencyException'.
[ERROR] :  Reason:
[ERROR] :  request for rect of invalid section (-1)
[ERROR] :  Stack trace:
[ERROR] :  0   CoreFoundation                      0x045791c8 __exceptionPreprocess + 152
[ERROR] :  1   libobjc.A.dylib                     0x03f5f8e5 objc_exception_throw + 44
[ERROR] :  2   CoreFoundation                      0x04579048 +[NSException raise:format:arguments:] + 136
[ERROR] :  3   Foundation                          0x00e1d4de -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
[ERROR] :  4   UIKit                               0x014b976f -[UITableViewRowData rectForSection:] + 181
[ERROR] :  5   UIKit                               0x013365b1 -[UITableView rectForSection:] + 80
[ERROR] :  6   test                                0x000d449e -[TiUITableView keyboardDidShowAtHeight:] + 430
[ERROR] :  7   test                                0x00130487 -[TiRootViewController handleNewKeyboardStatus] + 743
[ERROR] :  8   Foundation                          0x00e735ec __NSFireDelayedPerform + 372
[ERROR] :  9   CoreFoundation                      0x04537ac6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
[ERROR] :  10  CoreFoundation                      0x045374ad __CFRunLoopDoTimer + 1181
[ERROR] :  11  CoreFoundation                      0x0451f538 __CFRunLoopRun + 1816
[ERROR] :  12  CoreFoundation                      0x0451e9d3 CFRunLoopRunSpecific + 467
[ERROR] :  13  CoreFoundation                      0x0451e7eb CFRunLoopRunInMode + 123
[ERROR] :  14  GraphicsServices                    0x043215ee GSEventRunModal + 192
[ERROR] :  15  GraphicsServices                    0x0432142b GSEventRun + 104
[ERROR] :  16  UIKit                               0x0124ff9b UIApplicationMain + 1225
[ERROR] :  17  test                                0x000054c8 main + 456
[ERROR] :  18  libdyld.dylib                       0x04a5e701 start + 1
[ERROR] :  2014-07-09 17:42:14.092 test[7654:70b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'request for rect of invalid section (-1)'
[ERROR] :  *** First throw call stack:
[ERROR] :  (
[ERROR] :   0   CoreFoundation                      0x045791e4 __exceptionPreprocess + 180
[ERROR] :   1   libobjc.A.dylib                     0x03f5f8e5 objc_exception_throw + 44
[ERROR] :   2   CoreFoundation                      0x04579048 +[NSException raise:format:arguments:] + 136
[ERROR] :   3   Foundation                          0x00e1d4de -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
[ERROR] :   4   UIKit                               0x014b976f -[UITableViewRowData rectForSection:] + 181
[ERROR] :   5   UIKit                               0x013365b1 -[UITableView rectForSection:] + 80
[ERROR] :   6   test                                0x000d449e -[TiUITableView keyboardDidShowAtHeight:] + 430
[ERROR] :   7   test                                0x00130487 -[TiRootViewController handleNewKeyboardStatus] + 743
[ERROR] :   8   Foundation                          0x00e735ec __NSFireDelayedPerform + 372
[ERROR] :   9   CoreFoundation                      0x04537ac6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
[ERROR] :   10  CoreFoundation                      0x045374ad __CFRunLoopDoTimer + 1181
[ERROR] :   11  CoreFoundation                      0x0451f538 __CFRunLoopRun + 1816
[ERROR] :   12  CoreFoundation                      0x0451e9d3 CFRunLoopRunSpecific + 467
[ERROR] :   13  CoreFoundation                      0x0451e7eb CFRunLoopRunInMode + 123
[ERROR] :   14  GraphicsServices                    0x043215ee GSEventRunModal + 192
[ERROR] :   15  GraphicsServices                    0x0432142b GSEventRun + 104
[ERROR] :   16  UIKit                               0x0124ff9b UIApplicationMain + 1225
[ERROR] :   17  test                                0x000054c8 main + 456
[ERROR] :   18  libdyld.dylib                       0x04a5e701 start + 1
[ERROR] :  )
[ERROR] :  libc++abi.dylib: terminating with uncaught exception of type NSException
-- End simulator log ---------------------------------------------------------
And TableView to reproduce crash:
<TableView id="table">
    <HeaderView>
        <View height="45" width="Ti.UI.FILL">
            <TextField top="0" height="45" width="Ti.UI.FIll" hintText="Search" />
        </View>
    </HeaderView>
</TableView>
Any help appreciated.
Viewing all 352 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>