Process_Globals

margret

Well-Known Member
Licensed User
Longtime User
I have a question, should the variables declared under Process_Globals not be available to all modules? My understanding is that they should be. I can declare them and try to access them from a code module and get a variable undefined error. Is this normal? Are the Docs wrong or am I missing something. See Example:

B4X:
'MAIN Activity
Sub Process_Globals
      Dim MyStr As String
      MyStr = "Process Variable"
End Sub

'Code Module MySubs
Sub MessBox
      MsgBox(MyStr, "")
End Sub

This generates a variable undefined error. Based on what I've seen, this seems wrong that it should through an error.:sign0163:

Thanks,

Margret
 

lagore

Active Member
Licensed User
Longtime User
To access a Process_Global variable in another module you need to use the 'dot' notation, so MyStr in Main becomes Main.MyStr in the other modules, when you type Main. the auto complete will show all the items that are accessible in that module
Edward
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
Process Globals


Thanks for the quick reply. I am going to try it now. This will really help.:sign0060:

Margret
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
Process Globals - Activity Object

Thanks for the quick reply. I am going to try it now. This will really help.:sign0060:

Margret

I went in and changed the code. It still has no idea about the variable and comes up undefined. The code I listed was for an example. The real code is dealing with an activity object. I think it's the end of the road. I don't think it can be made to work in process global. If you have any other info, please let me know.

Thanks,

Margret
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…