davepamn Active Member Licensed User Longtime User Jan 22, 2014 #1 How do I create a singleton to pass values from one activity form to another
Erel B4X founder Staff member Licensed User Longtime User Jan 22, 2014 #2 You do not need to create a singleton for that. You can use Process_Global variables to share data or better use CallSubDelayed. Upvote 0
You do not need to create a singleton for that. You can use Process_Global variables to share data or better use CallSubDelayed.
davepamn Active Member Licensed User Longtime User Jan 22, 2014 #3 Erel said: You do not need to create a singleton for that. You can use Process_Global variables to share data or better use CallSubDelayed. Click to expand... Public sGlobalFactory as string This variable does not seem to be visible in the second activity. Did I declare the variable properly? Upvote 0
Erel said: You do not need to create a singleton for that. You can use Process_Global variables to share data or better use CallSubDelayed. Click to expand... Public sGlobalFactory as string This variable does not seem to be visible in the second activity. Did I declare the variable properly?
davepamn Active Member Licensed User Longtime User Jan 22, 2014 #4 Parsing code. Error Error parsing program. Error description: Undeclared variable 'sglobalfactory' is used before it was assigned any value. Upvote 0
Parsing code. Error Error parsing program. Error description: Undeclared variable 'sglobalfactory' is used before it was assigned any value.
davepamn Active Member Licensed User Longtime User Jan 22, 2014 #5 Sub cmdEnter_Down StartActivity(frmSetup) CallSubDelayed2(frmSetup,"SetFactory",sGlobalFactory) End Sub '******in frmSetup Sub SetFactory(sValue As String) sCurrentFactory=sValue End Sub The process seems difficult Is there a better way? Upvote 0
Sub cmdEnter_Down StartActivity(frmSetup) CallSubDelayed2(frmSetup,"SetFactory",sGlobalFactory) End Sub '******in frmSetup Sub SetFactory(sValue As String) sCurrentFactory=sValue End Sub The process seems difficult Is there a better way?
Erel B4X founder Staff member Licensed User Longtime User Jan 23, 2014 #6 Public sGlobalFactory as string This variable does not seem to be visible in the second activity. Did I declare the variable properly? Click to expand... You need to access it with the module name. For example: Code: Copy Main.sGlobalFactory = "Asd" Upvote 0
Public sGlobalFactory as string This variable does not seem to be visible in the second activity. Did I declare the variable properly? Click to expand... You need to access it with the module name. For example: Code: Copy Main.sGlobalFactory = "Asd"
netsistemas Active Member Licensed User Longtime User Apr 28, 2020 #8 I use this thenic: Create a PUBLIC VAR in Process_Global (frmUsuario activity sample) B4X: Copy Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. Type TD_Usuario(Codigo As Int, Nombre As String, Clave As String) Public AccionEnForm As String End Sub and in other activity, BEFORE CALL THIS activity somethink like this: B4X: Copy frmUsuario.AccionEnForm = "SetUsuario" StartActivity(frmUsuario) And use this public var in frmUsuario activity. You can returns values as this thecnic. Be carefour with this PUBLIC var between other calls. ALWAYS put somenthig in other calls to this Activity B4X: Copy frmUsuario.AccionEnForm = "nothingtodo" StartActivity(frmUsuario) Upvote 0
I use this thenic: Create a PUBLIC VAR in Process_Global (frmUsuario activity sample) B4X: Copy Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. Type TD_Usuario(Codigo As Int, Nombre As String, Clave As String) Public AccionEnForm As String End Sub and in other activity, BEFORE CALL THIS activity somethink like this: B4X: Copy frmUsuario.AccionEnForm = "SetUsuario" StartActivity(frmUsuario) And use this public var in frmUsuario activity. You can returns values as this thecnic. Be carefour with this PUBLIC var between other calls. ALWAYS put somenthig in other calls to this Activity B4X: Copy frmUsuario.AccionEnForm = "nothingtodo" StartActivity(frmUsuario)