Some text not showing up in ScrollView

Working on an app where I am inserting a title into the scrollview and also pulling a large text field from a SQLite data base and inserting that into the scrollview as well.  It works correctly in the simulator, but when I load it onto my Droid X I get the title, but the record from the SQLite doesn’t show.  You can tell the scroll view is working because the title scrolls like it is supposed to.  The scrollview seems to also adjust the scroll height, like it is pulling the data correctly from the database.  I have seen posts where you are unable to insert native objects into scrollview, but I don’t understand why label is showing the data is not.  Also have seen where scrollview doesn’t work on Android, but it appears to working.  The following code is also part of storyboard as well.  I am really being thrown, by the fact that is works correctly in the simulator, but not on the device.

    local dataTitle = display.newText("Show "…numVariable, display.contentWidth/2, display.statusBarHeight*2, native.systemFont, fSize*2)

        dataTitle.anchorX = .5

        scrollView:insert(dataTitle)

    local count = 0

    local rowY = tTop

    local output = “data3”

    local sql = “SELECT * from dataBase WHERE data2 = ‘01’”

    for row in db:nrows(sql) do

    

        if row.data1 == nil then

            print(" NO data FOUND ")

        end

        count = count +1

        local dbText = row.data1

        local t = display.newText(dbText, tTab, tTop + ((fSize * 1.25) + (fSize * 4.5 * count)), tWidth, 0, native.systemFont, fSize)

        t:setFillColor(255,255,255)

        t.anchorX = 0

        t.anchorY = 0

        scrollView:insert(t)

    

    end

Thanks for the help.

Can it be t:setFillColor(1, 1, 1)

Used (1,1,1) & (255,0,0) both of which did not work.  Could it be something within the data that is being pulled from the db that could be causing this?

It looks like your trying to insert white text into a white scrollview no?

Does changing the fill color of the text to black fix it ? ( 0, 0, 0 )

Oops. Sorry for missing that. Good catch!

Try red.

I’ve changed the text/background combinations to white on white, red on white, black on white, black on black, red on black & white on black.  The app’s normal background is black and the scrollview’s default is white.  I changed the background color by turning on or turning off the scrollview’s background.  In the simulator it works as expected, but once I get it on the Droid all I get is the Title and not what is being pulled from the DB.  It is like the data is not being pulled from the database on the device.  Is there something in the code that is causing this to not be inserted into the scrollview?

Also, the text from the DB can be printed to the console, so I feel that I can assume that the data is being pulled.  There are new line characters in the text that is being pulled from the DB, could this be the issue?  I have not yet tested this theory.

How big is the text you are trying to use?  Text is rendered using graphics textures and it’s easy, depending on your text settings to exceed the texture limit on your device.  You can use the system.getInfo( “maxTextureSize” ) call to print out your device’s maximum texture size.  On some device/os combinations, this could be as low as 1024x1024.

Perhaps you could post what device/os you are using, the code where you define your scrollView and the code where you create your display.newText so we can get an idea of what you are trying to do.

Rob

The size was the issue. Thank you very much. It’s an old Droid X

I did notice a new issue, that the new line characters are not recognized like they are displayed with simulator on OSX. The simulator of windows does not recognize these either, so I suspected this might be an issue. The reason that the data that is being pulled is so large, is because the database was rewritten to combine large groups of the data so that it would display as wanted. What the original intent was to show a number and then a comment after it. There would be from 20 - 40 records shown at anytime and the text will wrap for many records, sometimes as much as 4 lines. The data will not change, but the screen size & text might from device to device, but what was being faced was that the text from the previous record’s wrapped text would overlap the beginning of the following record. Is there a way to control the Y insertion point for each record based on the previous record’s overall height?

Another question, even if I were to figure out the Y insertion thing, would I still need to monitor the size of the text?  Would it be the size of scrollview that would be too big or would it be the size of each text object that is being inserted into the scrollview group that has the limit to adhere to (or both)?

If I need to post this in another area, please let me know.

Thanks again!!!

Its the size of the text object that’s the limit.  The newlines should work on all platforms, as long as you specify a width for the text.

Rob

That is great, that I can do.  Can you tell me how to get new lines to be inserted below the end of the line above it when the text is wrapped?

Can it be t:setFillColor(1, 1, 1)

Used (1,1,1) & (255,0,0) both of which did not work.  Could it be something within the data that is being pulled from the db that could be causing this?

It looks like your trying to insert white text into a white scrollview no?

Does changing the fill color of the text to black fix it ? ( 0, 0, 0 )

Oops. Sorry for missing that. Good catch!

Try red.

I’ve changed the text/background combinations to white on white, red on white, black on white, black on black, red on black & white on black.  The app’s normal background is black and the scrollview’s default is white.  I changed the background color by turning on or turning off the scrollview’s background.  In the simulator it works as expected, but once I get it on the Droid all I get is the Title and not what is being pulled from the DB.  It is like the data is not being pulled from the database on the device.  Is there something in the code that is causing this to not be inserted into the scrollview?

Also, the text from the DB can be printed to the console, so I feel that I can assume that the data is being pulled.  There are new line characters in the text that is being pulled from the DB, could this be the issue?  I have not yet tested this theory.

How big is the text you are trying to use?  Text is rendered using graphics textures and it’s easy, depending on your text settings to exceed the texture limit on your device.  You can use the system.getInfo( “maxTextureSize” ) call to print out your device’s maximum texture size.  On some device/os combinations, this could be as low as 1024x1024.

Perhaps you could post what device/os you are using, the code where you define your scrollView and the code where you create your display.newText so we can get an idea of what you are trying to do.

Rob

The size was the issue. Thank you very much. It’s an old Droid X

I did notice a new issue, that the new line characters are not recognized like they are displayed with simulator on OSX. The simulator of windows does not recognize these either, so I suspected this might be an issue. The reason that the data that is being pulled is so large, is because the database was rewritten to combine large groups of the data so that it would display as wanted. What the original intent was to show a number and then a comment after it. There would be from 20 - 40 records shown at anytime and the text will wrap for many records, sometimes as much as 4 lines. The data will not change, but the screen size & text might from device to device, but what was being faced was that the text from the previous record’s wrapped text would overlap the beginning of the following record. Is there a way to control the Y insertion point for each record based on the previous record’s overall height?

Another question, even if I were to figure out the Y insertion thing, would I still need to monitor the size of the text?  Would it be the size of scrollview that would be too big or would it be the size of each text object that is being inserted into the scrollview group that has the limit to adhere to (or both)?

If I need to post this in another area, please let me know.

Thanks again!!!

Its the size of the text object that’s the limit.  The newlines should work on all platforms, as long as you specify a width for the text.

Rob