Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4755] Android: textField: Property "softKeyboardOnFocus" does not work

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2012-02-01T11:37:33.000+0000
Affected Version/sn/a
Fix Version/sSprint 2012-01, Release 2.0.0, Release 1.8.1
ComponentsAndroid
Labelskeyboard, module_textfield, parity, qe-testadded, scrollViews
ReporterFlorent
AssigneePing Wang
Created2011-06-15T02:31:13.000+0000
Updated2012-03-03T22:27:52.000+0000

Description

When textfield in windows gain focus, the keyboard used to hide them. So i create a big scrollView and put everything inside. It worked perfectly: i was able to see what i wrote. However now, the keyboard launch itself with the windows, so i have to press back button to hide him. I tried myTextField.blur() but keyboard still happen. Only way to prevent this is to add focusable: false to my textField, but then i can not acces to the keyboard (even by adding an event to set focusable: true). Here is my code: To launch the windows in app.js:
 
var win = Titanium.UI.createWindow({
	backgroundColor: '#D1D1D1',
	url: '/authentification.js',
	navBarHidden: true,
	fullscreen: false
});
win.open();
and authentification.js:
 

var win = Titanium.UI.currentWindow;

var deviceWidth  = Titanium.Platform.displayCaps.platformWidth;
var deviceHeight = Titanium.Platform.displayCaps.platformHeight;

var MainScrollView = Titanium.UI.createScrollView({
    contentWidth:deviceWidth,
    contentHeight:deviceHeight*79/100,
    top:deviceHeight*11/100,
	left:0
});

var view = Titanium.UI.createView({
    top: deviceHeight * 39 / 100,
	left: deviceWidth * 4/100,
	width: deviceWidth * 92/100,
	height: deviceHeight * 25 / 100,
	borderRadius: 5,
	borderWidth: 2,
	borderColor: '#9B9B9B',
	backgroundColor: 'white'
});


var txtFieldPasswd = Titanium.UI.createTextField({
	passwordMask:true,
	left: deviceWidth*5/100,
	width: deviceWidth*82/100,
	top: deviceHeight*10/100,		
	height: deviceHeight* 8/100,
	softKeyboardOnFocus:1 
});
view.add(txtFieldPasswd);

MainScrollView.add(view);
win.add(MainScrollView);

Comments

  1. Paul Dowsett 2011-07-05

    In order for us to progress this issue, would you please edit the ticket to use the wiki formatting syntax provided. Also, please check your ticket against [the Jira Ticket Checklist](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-Summary%3AtheJiraTicketChecklist) to ensure you have all the points covered. Many thanks
  2. Florent 2011-07-06

    I update the problem to make it easier to create. I still don't know where it comes from that the kayboard pop up by itself.
  3. Paul Dowsett 2011-07-08

    Florent Thank you for the changes you have made to the ticket, as now it is almost complete. Would you mind testing the code on 1.7.X as well, though, after installing it from [Continuous Builds](http://wiki.appcelerator.org/display/guides/Continuous+Builds)? Also would you please copy and paste the Titanium SDK builds, including build date and hash, you are using? The full list of what is required for tickets is available in the [Jira Ticket Checklist](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-Summary%3AJiraTicketChecklist), for future reference. Cheers
  4. Florent 2011-07-13

    Hi Paul, I tested the code on 1.7.X as you asked (1.7.2.v20110712190239 sha1: 2a057a04b19a9a837d2fe221a8858969dde0c347). It works well on emulateur with APIs2.3.3 and 2.3.3 and 2.2 but on device it still doesn't work (Samsung Galaxy S Android sdk 2.2 and Nexus one with 2.3.4) Here is the content of the logfile:
       Logfile initialized
       [INFO] logfile = D:\Documents and Settings\bGouny\Mes documents\Dev\Test\TestFlo\build.log
       [DEBUG] D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\builder.py install "TestFlo" "D:\Documents and Settings\bGouny\Mes documents\sdk\android-sdk-windows" "D:\Documents and Settings\bGouny\Mes documents\Dev\Test\TestFlo" "flo.test.com" "16"
       [INFO] Titanium SDK version: 1.7.2 (07/12/11 19:02 9f3ea99...)
       [DEBUG] Waiting for device to be ready ...
       [TRACE] adb devices returned 2 devices/emulators
       [DEBUG] Device connected... (waited 0 seconds)
       [DEBUG] waited 0.031000 seconds on emulator to get ready
       [DEBUG] flo.test.com installed? False
       [INFO] Copying project resources..
       [INFO] Tiapp.xml unchanged, skipping class generation
       [DEBUG] Processing Android resource drawables
       [DEBUG] creating unsigned apk: D:\Documents and Settings\bGouny\Mes documents\Dev\Test\TestFlo\build\android\bin\app-unsigned.apk
       [DEBUG] from resource zip => assets/Resources/KS_nav_ui.png
       [DEBUG] from resource zip => assets/Resources/KS_nav_views.png
       [DEBUG] from resource zip => assets/Resources/app.js
       [DEBUG] from resource zip => assets/Resources/appicon.png
       [DEBUG] from resource zip => assets/Resources/authentification.js
       [DEBUG] from resource zip => assets/Resources/default.png
       [DEBUG] from resource zip => assets/tiapp.xml
       [DEBUG] from resource zip => res/drawable/appicon.png
       [DEBUG] from resource zip => res/drawable/background.png
       [DEBUG] from resource zip => res/layout/titanium_tabgroup.xml
       [DEBUG] from resource zip => AndroidManifest.xml
       [DEBUG] from resource zip => resources.arsc
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\modules\titanium-ui.jar => ti/modules/titanium/ui/widget/webview/binding.js
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\modules\titanium-ui.jar => ti/modules/titanium/ui/widget/webview/binding.min.js
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\modules\titanium-ui.jar => ti/modules/titanium/ui/widget/webview/json2.js
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\titanium.jar => org/apache/Commons-NOTICE.txt
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\titanium.jar => org/apache/HttpComponents-NOTICE.txt
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\titanium.jar => org/apache/mime4j-NOTICE.txt
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\titanium.jar => org/appcelerator/titanium/build.properties
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\titanium.jar => org/appcelerator/titanium/res/drawable/background.png
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\titanium.jar => org/appcelerator/titanium/res/drawable/btn_check_buttonless_on.png
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\titanium.jar => org/appcelerator/titanium/res/drawable/btn_check_buttonless_on_18.png
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\titanium.jar => org/appcelerator/titanium/res/drawable/btn_check_buttonless_on_48.png
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\titanium.jar => org/appcelerator/titanium/res/drawable/btn_more.png
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\titanium.jar => org/appcelerator/titanium/res/drawable/btn_more_18.png
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\titanium.jar => org/appcelerator/titanium/res/drawable/btn_more_48.png
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\titanium.jar => org/appcelerator/titanium/res/drawable/btn_picker_normal.9.png
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\titanium.jar => org/appcelerator/titanium/res/drawable/btn_picker_pressed.9.png
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\titanium.jar => org/appcelerator/titanium/res/drawable/btn_picker_selected.9.png
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\titanium.jar => org/appcelerator/titanium/res/drawable/default_icon.png
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\titanium.jar => org/appcelerator/titanium/res/drawable/photoDefault.png
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\smalljs.jar => org/mozilla/javascript/resources/Messages.properties
       [DEBUG] from JAR D:\Documents and Settings\All Users\Application Data\Titanium\mobilesdk\win32\1.7.2.v20110712190239\android\smalljs.jar => org/mozilla/javascript/resources/Messages_fr.properties
       [DEBUG] Waiting for device to be ready ...
       [TRACE] adb devices returned 2 devices/emulators
       [DEBUG] Device connected... (waited 0 seconds)
       [DEBUG] waited 0.047000 seconds on emulator to get ready
       [INFO] Installing application on emulator
       [INFO] Application installed. Launch from drawer on Home Screen
       
    EDIT: I was wrong about the sdk version of my mobile, it's sdk 2.2 and not 2.3.2
  5. Ping Wang 2011-12-12

    When textfield in scrollView, keyboard displays automatically on device (tried 2.3.4 and 3.1). It does not happen on emulator (tried 2.2, 3.1 and 4.0). For device 3.1, keyboard displays automatically as long as there is a textfield (no matter whether it is in a scrollview). But for device 2.3.4, keyboard does not display automatically if textfield is in a View. For device 2.3.4 and 3.1, the property of textField "softKeyboardOnFocus:1" does not work.
  6. Wilson Luu 2012-01-17

    Closing bug. Verified fix on: SDK build: 1.9.0.v20120117144634 Runtime: V8, Rhino Titanium Studio, build: 1.0.8.201201131907 OS: Mac OS X Lion (10.7.1) Device: Droid 3 (2.3.4)

JSON Source