I have upgraded to 2013.1076
Still have the same problem as far as I can see. Below the code I just used to test it, followed by the output in the simulator.
During the For loop, no updates are shown on the screen but after the For loop ends, the progressbar comes to life.
Am I doing something wrong here, or is the progressbar not supposed to be able to show progress from inside a For loop?
local widget = require( “widget” )
– Database connectie
require “sqlite3”
– Open test.db. If the file doesn’t exist it will be created
local path = system.pathForFile(“test.db”, system.DocumentsDirectory)
db = sqlite3.open( path )
–Handle the applicationExit event to close the db
local function onSystemEvent( event )
if( event.type == “applicationExit” ) then
db:close()
end
end
local droptesttable = [[DROP TABLE testtable;]]
local createtesttable = [[CREATE TABLE IF NOT EXISTS testtable
(testfield1 integer,
testfield2 integer,
testfield3 text);]]
db:exec (droptesttable)
if db:errcode() > 0 then
print (“statement:”…droptesttable)
print (“error:”…db:errcode() )
end
db:exec (createtesttable)
if db:errcode() > 0 then
print (“statement:”…createtesttable)
print (“error:”…db:errcode() )
end
– Create a new progressView
local newProgressView = widget.newProgressView
{
left = 50,
top = 200,
width = 200,
isAnimated = true,
}
local currentProgress = 0
amt = 5
jump = 1 / amt
print (“started:”…os.time())
for x=1,amt do
for y=1, 10 do
local inserttesttable = [[INSERT INTO testtable VALUES (]]…x…[[,]]…y…[[, ‘]]…“text”…x…"_"…y…[[’);]]
print (inserttesttable )
db:exec (inserttesttable )
if db:errcode() > 0 then
print (“statement:”…inserttesttable )
print (“error:”…db:errcode() )
end
end
currentProgress = currentProgress + jump
print(“step by step, but no progress is shown yet!”…x, jump, currentProgress)
newProgressView:setProgress( currentProgress )
end
print (“ended:”…os.time())
------------------------------------------------------------------------------------------------------------------------------------------------------------ Output below
------------------------------------------------------------------------------------------------------------------------------------------------------------Copyright © 2009-2013 C o r o n a L a b s I n c .
Version: 2.0.0
Build: 2013.1076
started:1367953134
INSERT INTO testtable VALUES (1, 1, ‘text1_1’);
INSERT INTO testtable VALUES (1, 2, ‘text1_2’);
INSERT INTO testtable VALUES (1, 3, ‘text1_3’);
INSERT INTO testtable VALUES (1, 4, ‘text1_4’);
INSERT INTO testtable VALUES (1, 5, ‘text1_5’);
INSERT INTO testtable VALUES (1, 6, ‘text1_6’);
INSERT INTO testtable VALUES (1, 7, ‘text1_7’);
INSERT INTO testtable VALUES (1, 8, ‘text1_8’);
INSERT INTO testtable VALUES (1, 9, ‘text1_9’);
INSERT INTO testtable VALUES (1, 10, ‘text1_10’);
step by step, but no progress is shown yet!1 0.2 0.2
INSERT INTO testtable VALUES (2, 1, ‘text2_1’);
INSERT INTO testtable VALUES (2, 2, ‘text2_2’);
INSERT INTO testtable VALUES (2, 3, ‘text2_3’);
INSERT INTO testtable VALUES (2, 4, ‘text2_4’);
INSERT INTO testtable VALUES (2, 5, ‘text2_5’);
INSERT INTO testtable VALUES (2, 6, ‘text2_6’);
INSERT INTO testtable VALUES (2, 7, ‘text2_7’);
INSERT INTO testtable VALUES (2, 8, ‘text2_8’);
INSERT INTO testtable VALUES (2, 9, ‘text2_9’);
INSERT INTO testtable VALUES (2, 10, ‘text2_10’);
step by step, but no progress is shown yet!2 0.2 0.4
INSERT INTO testtable VALUES (3, 1, ‘text3_1’);
INSERT INTO testtable VALUES (3, 2, ‘text3_2’);
INSERT INTO testtable VALUES (3, 3, ‘text3_3’);
INSERT INTO testtable VALUES (3, 4, ‘text3_4’);
INSERT INTO testtable VALUES (3, 5, ‘text3_5’);
INSERT INTO testtable VALUES (3, 6, ‘text3_6’);
INSERT INTO testtable VALUES (3, 7, ‘text3_7’);
INSERT INTO testtable VALUES (3, 8, ‘text3_8’);
INSERT INTO testtable VALUES (3, 9, ‘text3_9’);
INSERT INTO testtable VALUES (3, 10, ‘text3_10’);
step by step, but no progress is shown yet!3 0.2 0.6
INSERT INTO testtable VALUES (4, 1, ‘text4_1’);
INSERT INTO testtable VALUES (4, 2, ‘text4_2’);
INSERT INTO testtable VALUES (4, 3, ‘text4_3’);
INSERT INTO testtable VALUES (4, 4, ‘text4_4’);
INSERT INTO testtable VALUES (4, 5, ‘text4_5’);
INSERT INTO testtable VALUES (4, 6, ‘text4_6’);
INSERT INTO testtable VALUES (4, 7, ‘text4_7’);
INSERT INTO testtable VALUES (4, 8, ‘text4_8’);
INSERT INTO testtable VALUES (4, 9, ‘text4_9’);
INSERT INTO testtable VALUES (4, 10, ‘text4_10’);
step by step, but no progress is shown yet!4 0.2 0.8
INSERT INTO testtable VALUES (5, 1, ‘text5_1’);
INSERT INTO testtable VALUES (5, 2, ‘text5_2’);
INSERT INTO testtable VALUES (5, 3, ‘text5_3’);
INSERT INTO testtable VALUES (5, 4, ‘text5_4’);
INSERT INTO testtable VALUES (5, 5, ‘text5_5’);
INSERT INTO testtable VALUES (5, 6, ‘text5_6’);
INSERT INTO testtable VALUES (5, 7, ‘text5_7’);
INSERT INTO testtable VALUES (5, 8, ‘text5_8’);
INSERT INTO testtable VALUES (5, 9, ‘text5_9’);
INSERT INTO testtable VALUES (5, 10, ‘text5_10’);
step by step, but no progress is shown yet!5 0.2 1
ended:1367953138