bernardR Member Licensed User Longtime User Nov 23, 2022 #1 Hello, My goal is to reset many public variables defined in a code module named 'zz'. The zz.Process_Globals command seems fine. (See attached example). The first compilation works in debug and release mode. However, if a compilation in relase mode has already been done, a compilation error occurs if you want to compile again (debug or release mode). Here is the error: zz.Process_Globals src\b4a\example\main.java:432: error: cannot find symbol mostCurrent._zz._process_globals /*String*/ (); ^ symbol: method _process_globals() location: variable _zz of type zzThanks, B4X: In main activity Sub Button1_Click zz.Process_Globals labl1.Text = "Test="&zz.test End Sub In zzmodule Sub Process_Globals Public test As Int End Sub Attachments ResetVar.zip ResetVar.zip 6.9 KB · Views: 448
Hello, My goal is to reset many public variables defined in a code module named 'zz'. The zz.Process_Globals command seems fine. (See attached example). The first compilation works in debug and release mode. However, if a compilation in relase mode has already been done, a compilation error occurs if you want to compile again (debug or release mode). Here is the error: zz.Process_Globals src\b4a\example\main.java:432: error: cannot find symbol mostCurrent._zz._process_globals /*String*/ (); ^ symbol: method _process_globals() location: variable _zz of type zzThanks, B4X: In main activity Sub Button1_Click zz.Process_Globals labl1.Text = "Test="&zz.test End Sub In zzmodule Sub Process_Globals Public test As Int End Sub
DonManfred Expert Licensed User Longtime User Nov 23, 2022 #2 I don´t think it is a good idea to call the sub Process_Globals manually. Create a sub in your codemodule and set all globals vars new in this sub. Call this sub to reset Upvote 0
I don´t think it is a good idea to call the sub Process_Globals manually. Create a sub in your codemodule and set all globals vars new in this sub. Call this sub to reset
kimstudio Active Member Licensed User Longtime User Nov 23, 2022 #3 I never know that sub Process_Globals is actually a sub that can be called... maybe there are some speical code will be added when translate it to java code. Upvote 0
I never know that sub Process_Globals is actually a sub that can be called... maybe there are some speical code will be added when translate it to java code.
Erel B4X founder Staff member Licensed User Longtime User Nov 23, 2022 #4 You should never call the globals subs explicitly. The way I would have done it is with a simple class. Create a new class instance when you want to reset the state. Upvote 0
You should never call the globals subs explicitly. The way I would have done it is with a simple class. Create a new class instance when you want to reset the state.