native.newTextBox not scrolling on Android

Hi there,

I have a newTextBox control on one of my pages and it works great on my iPhone.

When I build the app for Android, I cannot scroll through the text box. The text box is displayed accurately, and it shows the start of my text, but does not let me scroll down to view the rest of the text.

I have tried creating a test app to just check this, but it doesn’t work either - the code is shown below:

[lua]local myBox = native.newTextBox(15, 50, 200, 100)
myBox:setTextColor(255, 0, 255)
myBox.font = native.newFont( native.systemFont, 14 )
myBox.align = “left”
myBox.hasBackground = false

myBox.text = “One bright day in the middle of the night,\nTwo dead men got up to fight.\nBack-to-back they faced one another,\nDrew their swords and shot each other.”[/lua]

Is there something I’m missing??

Thanks
[import]uid: 74250 topic_id: 18750 reply_id: 318750[/import]

I have been playing about with this some more & think there might be a bug!

I looked at the “Native Display Objects” example, increased the amount of text in the newTextBox and then built it for both iOS & Android.

On the iPhone the text box is scrollable and all of the text can be viewed. On the Android however I have the same problem that I described in my first post - namely that the box is not scrollable and therefore only the first three lines of text are viewable.

Can anyone confirm this behaviour, or is there a way to fix this??

tia [import]uid: 74250 topic_id: 18750 reply_id: 72162[/import]

We’ve made some improvement to the TextBox on Android that makes its scrollable and editable, but this change is only available in our daily build system at the moment which you can only access if you are a paid subscriber. Until then, you’ll have to wait for the TextBox change in the next release version, which should be coming soon. [import]uid: 32256 topic_id: 18750 reply_id: 72364[/import]

Hi Joshua,

Thanks for the update - thats great news! [import]uid: 74250 topic_id: 18750 reply_id: 72633[/import]

A new trial version of the Corona SDK just came out today. It contains the updated TextBox that you are looking for… plus, lots of other Android updates as well (see the release notes for details). You can download it by clicking the “Download” button at the top of this web page. [import]uid: 32256 topic_id: 18750 reply_id: 72636[/import]

Using the latest Build as of now (March 11, 2012) which is 2012.765, I find I have the same problem.

Builds targeted to Galaxy Tab and installed on my Toshiba Thrive tablet (Android 3.1) will display the text dynamically, but not allow the user to tap/drag to affect scrolling. Not a good thing.

I can report that using the 2011.704 Build for the Kindle Fire (Android 2.3), the native.newTextBox features does work interactively as expected, same as on the iPad.

I have to consider this a compiler bug (?)

[import]uid: 6114 topic_id: 18750 reply_id: 92671[/import]

alangrus,

It sounds like your app is being built by a much older version of Corona. Can you please check your “build.settings” file to see if the following setting is there…
[lua]settings =
{
build =
{
custom = “xxxxx”,
}
}[/lua]

That build table allows you to build your app for a specific version of Corona, regardless of the version of the Corona Simulator that you are running. This way you can evaluate the newest daily builds of Corona, but still target a release version of Corona for your production apps.

If you have the above build table defined, then that is targeting an old version of Corona and you need to delete it from your build.settings. [import]uid: 32256 topic_id: 18750 reply_id: 92855[/import]

Hello Joshua, thanks for your thoughts on this.

My “build.settings” file has never had a “build” table defined, so thats not the problem.

Again, I am using the latest Build 2012.765. Do I need to have build.custom table defined and if so what syntax is required?

I tried custom = “2012.765” - Compiler didn’t like that.
[import]uid: 6114 topic_id: 18750 reply_id: 92877[/import]

alangrus,
Don’t add the “build” table to your build.settings file. That will cause more unexpected problems.

Everyone,
I just tested the newest build with sample project “Interface\NativeDisplayObjects” and adding several more lines of text to it. It definitely worked on my Android devices. Now, the text box does not show a scroll bar by default (that’s really up to the device’s Android theme), but it was definitely scrollable. I’ve also flagged the text box as not editable and it still scrolled. I’ve tried this on a Samsung Galaxy S2 and a Kindle Fire. [import]uid: 32256 topic_id: 18750 reply_id: 92886[/import]

Everyone,

I just managed to reproduce this issue on a Motorola Xoom. This appears to be an Android 3.x issue only. Okay… I’ll write this up as a bug report to be fixed. [import]uid: 32256 topic_id: 18750 reply_id: 92888[/import]

Yes, I agree Joshua as I got the same results. Scrolling interactivity works fine on Kindle Fire (Android 2.3) but does not offer interactivity on Toshiba Thrive (Android 3.1 - going on Android 4 soon).

I will keep ears open for a build that will accommodate this feature.

Thanks for looking into this.

  • Alan Gruskoff
    [import]uid: 6114 topic_id: 18750 reply_id: 92894[/import]

Alan,

I can’t reproduce this issue anymore. I know I said I was able to reproduce this issue on a Motorola Xoom, but when I tried to reproduce it again today the vertical scrolling worked fine. Did we fix this issue by accident since last we spoke? Hmmm…

Would you mind testing your app with the newest daily build to see if this is fixed? [import]uid: 32256 topic_id: 18750 reply_id: 93672[/import]

Hi Joshua, thanks for posting.
I did install SDK 2012.767, glad to see Kindle Fire in the device list.

I get the same failure of scrolling on Toshiba Thrive on Android 3.1.

Here is the same code I used for the Kindle Fire:

StatusTextBox = native.newTextBox( 372, 676, 200, 90 )  
StatusTextBox.align = "left"  
StatusTextBox.hasBackground = false  
StatusTextBox.size = 13  
StatusTextBox:setTextColor( 16, 16, 128 )  
StatusTextBox.text = StatusText  

Turn this around, can we get a copy of your testing code???
[import]uid: 6114 topic_id: 18750 reply_id: 93769[/import]

Alan,

I figured it out, thanks to your sample code. This issue only happens on an Android 3.x device when the text box is NOT editable. If you make it editable, then the box is scrollable. This means that Android has changed the behavior of text fields to not be scrollable if flagged as disabled.

So, this forces me to change the behavior a bit. What I’m going to do is always set up the text box to be enabled, but I’ll make it read-only. What this means is that an un-editable textbox will no longer appear as greyed out on Android, it will have a white background by default just like an editable field, but the keyboard will be ignored. Since it will be read-only and enabled, this means users will be able to make text selection and copy text to the clipboard, which is actually kind of a nice feature, but users won’t be able to paste to the field because it’s read-only.

Anyways, that’s my brief ramble of what I’m going to change. I plan on finishing this soon. [import]uid: 32256 topic_id: 18750 reply_id: 93870[/import]

Alan,

This bug will be fixed in daily build #768. [import]uid: 32256 topic_id: 18750 reply_id: 93968[/import]

Hello Joshua and Coronas

As the Toshibas just asked me “Where’s our Android App?”, I thought I would check in. I just installed Build 777 (nice to see iPad Retina device as my New iPad comes tomorrow!). I compiled a version with the property:

StatusTextBox.isEditable  

which is interesting. It does Scroll nice. I also brings up the half screen keyboard for “editing”, which I don’t want in this case. I can say that my users like to select/copy that status text, so thats a feature we do want.

Thanks [import]uid: 6114 topic_id: 18750 reply_id: 98335[/import]

alangrus,

To prevent the keyboard from showing up, you would have to set the isEditable property to false.
[lua]myTextBox.isEditable = false[/lua]

As of the newest daily build, the text box will be scrollable even when it is not editable and the text will be selectable for copy/paste operations. So I believe it does what you want now, right? [import]uid: 32256 topic_id: 18750 reply_id: 98365[/import]

Ah yes, thats what we want! Just like the other scrolling controls now using Build 777.

This lets me finish and submit my App. Thanks for the help and staying in touch.

  • Alan Gruskoff
    Digital Showcase LLC [import]uid: 6114 topic_id: 18750 reply_id: 98391[/import]