console/log like output on the screen

Hello all.

I'd like to display a bunch of debug information on the screen and then just keep adding to it without erasing anything. I tried using native.newTextBox but that erases the current contents after each textBox.text = ".."

What's the best approach here ?

thank you

You may want to look into using print statements (instead of using newTextBox). The print statement will spit out text on terminal, and it won't disappear unless you tell it to clear scroll back.

Naomi

Hi Naomi.

yes, I know about print statements but as you mentioned the output goes to the terminal and not to the screen.
I am debugging a multi touch application on the device itself so the terminal output is not the way to go for me. I need to be able to output the debug information to the screen, since getting to the terminal output when working on the device itself is VERY spotty, laggy and most of the time not coming thru at all.

cheers

Ah, sounds like print-statement isn't a good fit for what you need. Let's hope someone knowledgeable will jump in and help out.

Naomi

i often use display.newText for purposes of on-screen testing
it will not help you to display all your terminal information, but useful things can be done this way

what can you "print()" is what you also can "display.newText"

thanks for the reply ... but can you keep the information on the screen without overwriting it each time ? that's my goal here.
... adding more information to the text already on the screen without overwriting it.

why don't you just concatenate strings? something like this:

1
2
3
4
5
6
7
local str = ""
local textfield = display.newText( str, 0, 0, native.systemFont, 12)
 
local update = function( morestring )
     str = str .. "\n" .. morestring
     textfield.text = str
end

thank you. that might work. I'll give it a try.

Thats fine.
But I really don't understand why you're not using the console in xcode organiser for ios and ddms for android for output from the device. It's much easier.

because the output from the device to the console in xcode organizer is intermittent, mixed with other things coming from the device (unrelated to my application) and also most of the time the output doesn't appear in the console until I exit the application.

I agree the organizer console can act a bit strange sometimes and there should have been somekind of filtering option like there is in ddms.
Hope it will work out for you.

@rbhfst,

you gotta understand that the textBox is not at fault, the way you are using it is.

local lists = ""

local name = "rbhfst"

lists = name

then if you change the name,

name = "corona"

lists = name

you *will* overwrite the data in the lists...

so if you get the data first like so,

local temp = lists
lists = temp .. "\n" .. name

then lists will always get appended as you expected...

now simply replace lists with the textBox.text

cheers,

?:)

that's a great explanation. thank you for taking the time.

views:1591 update:2011/11/2 21:34:51
corona forums © 2003-2011