Sub schreib
If writing=True Then Return
writing=True
Label1.Text=Basis.t_saving & "x"
' The 3 lines above are executed. I can see label1.text
Msgbox ("vor deletepic","")
' not executed. I see no msgbox
Label1.Text="1"
' not executed
...
What does it mean? What actually happens?it behaves beyond all logic
Sub schreib
If writing=True Then Return
writing=True
Label1.Text=Basis.t_saving
' All the follwing lines are executed in debug mode.
' And in release mode, I see no changes on the screen, the sub deeletepic seems to be executed, but not readphoto.
' Msgbox ("vor deletepic","")
' Label1.Text="1"
CallSubDelayed (Me,updatescreen(1))
Basis.deletepic (Main.photonumber)
' Msgbox ("vor readphoto","")
' Label1.Text="2"
CallSubDelayed (Me,updatescreen(2))
Basis.readphoto (Main.photonumber & ".dat")
Dim s As String
s=Main.hostname & "_downloaded.php?nr=" & Main.photonumber & "&p=" & Settings.pnr
DoEvents
Dim jobx As HttpJob
jobx.Initialize ("x",Me)
Log (s)
' Msgbox (s,"")
' Label1.Text=s
jobx.Download (s)
CallSubDelayed (Me,updatescreen(3))
DonManfred already explained why CallSubDelayed (Me,updatescreen(1)) does not work as expected. You should start by fixing that.The problem is - I do not know that. And it has nothing to do with the push service, I checked that.
It is a simple sub in an activity module.
B4X:Sub schreib If writing=True Then Return writing=True Label1.Text=Basis.t_saving ' All the follwing lines are executed in debug mode. ' And in release mode, I see no changes on the screen, the sub deeletepic seems to be executed, but not readphoto. ' Msgbox ("vor deletepic","") ' Label1.Text="1" CallSubDelayed (Me,updatescreen(1)) Basis.deletepic (Main.photonumber) ' Msgbox ("vor readphoto","") ' Label1.Text="2" CallSubDelayed (Me,updatescreen(2)) Basis.readphoto (Main.photonumber & ".dat") Dim s As String s=Main.hostname & "_downloaded.php?nr=" & Main.photonumber & "&p=" & Settings.pnr DoEvents Dim jobx As HttpJob jobx.Initialize ("x",Me) Log (s) ' Msgbox (s,"") ' Label1.Text=s jobx.Download (s) CallSubDelayed (Me,updatescreen(3))
You should explain CLEARLY what is expected, what does not work, with the relevant code, screenshots and log reports, or post a project to test because I think that nobody understands your problem.When I take out all these callsubdelayed, it still does not work.
Main.script="Draw/"
Activity.finish
StartActivity (Show)
Sub schreib
If writing=True Then Return
writing=True
Label1.Text=Basis.t_saving
' Msgbox ("vor deletepic","")
Label1.Text="1"
' CallSubDelayed (Me,updatescreen(1))
Basis.deletepic (Main.photonumber)
' Msgbox ("vor readphoto","")
Label1.Text="2"
' CallSubDelayed (Me,updatescreen(2))
Basis.readphoto (Main.photonumber & ".dat")
Dim s As String
s=Main.hostname & "_downloaded.php?nr=" & Main.photonumber
DoEvents
Dim jobx As HttpJob
jobx.Initialize ("x",Me)
Log (s)
' Msgbox (s,"")
Label1.Text=s
jobx.Download (s)
' CallSubDelayed (Me,updatescreen(3))
End Sub
OK, now I see what you're trying to do. Schreib is in fact the sub called by unzip_UnZipDone and unzip_unzipprogression, two events raised by my Archiver lib. Contrary to Erel, I raise all my events in their thread. If you want to run these events in the main thread to perform an operation that requires to be run in this UI thread (e.g. displaying a MsgBox, updating a view, etc.), you have to call your code with CallSubDelayed. So your solution could simply be CallSubDelayed(Me, "schreib") in the two events. BTW, you should rename this function to add an underscore in its name. And stop running in Debug Mode. Different thread = Release Mode. It's not an option.OK, the file is attached. After pressing the only button "Do it" the procedure starts.
In debug mode:
Module synch, line 179: Module show should open. But it does not.
B4X:Main.script="Draw/" Activity.finish StartActivity (Show)
In release mode:
Now it crashes, I tried USB debugging but I get no log (I disconnected, the device is in USB debug mode, connection to the computer is established.
But I know it is in this sub, because this line "Basis.readphoto (Main.photonumber & ".dat")" takes quite a few seconds, so that the tex of the label ("2") should be visible.
B4X:Sub schreib If writing=True Then Return writing=True Label1.Text=Basis.t_saving ' Msgbox ("vor deletepic","") Label1.Text="1" ' CallSubDelayed (Me,updatescreen(1)) Basis.deletepic (Main.photonumber) ' Msgbox ("vor readphoto","") Label1.Text="2" ' CallSubDelayed (Me,updatescreen(2)) Basis.readphoto (Main.photonumber & ".dat") Dim s As String s=Main.hostname & "_downloaded.php?nr=" & Main.photonumber DoEvents Dim jobx As HttpJob jobx.Initialize ("x",Me) Log (s) ' Msgbox (s,"") Label1.Text=s jobx.Download (s) ' CallSubDelayed (Me,updatescreen(3)) End Sub
Someone please help me. Charge something if you want, or let me donate, whatever.
I cannot test your project because it requires many libraries that I don't have. So to help you, I need more than just a line saying "it crashes".Thank you, but it crashes also with callsubdelayed.
Basis.debuginfo ("starting unzip",False)
ar.AsyncUnZip (Main.outdir,fname,Main.outdir,"unzip")
Sub unzip_UnZipDone(CompletedWithoutError As Boolean, NbOfFiles As Int)
' Msgbox (CompletedWithoutError, NbOfFiles)
Basis.debuginfo ("unzipdone starting schreib",False)
CallSubDelayed (Me,schreib)
End Sub
Sub unzip_unzipprogression (count As Int, filename As String)
Basis.debuginfo ("unzipprogression starting schreib",False)
CallSubDelayed (Me,schreib)
End Sub
I know that, but I did not have more info.
CallSubDelayed (Me,schreib)
no one told you to remove them. You just need to use them the right way. See callsubdelayed2 (as i already explained)When I take out all these callsubdelayed, it still does not work.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?