pjetson Member Licensed User Longtime User Aug 10, 2017 #1 I'm trying to rearrange my B4A project by moving some of the code into modules. And it's not going well :-( The latest problem I've run up against is the error message "Code modules do not support Me keyword". One of the subs that I've moved into a code module runs an HttpJob: Code: Copy Dim QSjob As HttpJob QSjob.Tag = "QS.json" QSjob.Initialize("get_QS", Me) QSjob.Download(Main.QS_URL & Main.InvitationCode) The compiler is objecting to the "Me" in the QSjob.Initialize line. What is the alternative to using Me in this statement? I've tried searching the forums, but I don't seem to be able to turn up anything useful, other than a few places where it says that code modules do not support the Me keyword. The only reference I can find in Wyken's book is that Me "cannot be used in a code module". Those statements are not really very helpful without offering an alternative, even if the only answer is simply that I have to move the code using the Me back into the Main module!
I'm trying to rearrange my B4A project by moving some of the code into modules. And it's not going well :-( The latest problem I've run up against is the error message "Code modules do not support Me keyword". One of the subs that I've moved into a code module runs an HttpJob: Code: Copy Dim QSjob As HttpJob QSjob.Tag = "QS.json" QSjob.Initialize("get_QS", Me) QSjob.Download(Main.QS_URL & Main.InvitationCode) The compiler is objecting to the "Me" in the QSjob.Initialize line. What is the alternative to using Me in this statement? I've tried searching the forums, but I don't seem to be able to turn up anything useful, other than a few places where it says that code modules do not support the Me keyword. The only reference I can find in Wyken's book is that Me "cannot be used in a code module". Those statements are not really very helpful without offering an alternative, even if the only answer is simply that I have to move the code using the Me back into the Main module!
DonManfred Expert Licensed User Longtime User Aug 10, 2017 #2 Move the code to a activity, class or a service. Codemoduless can not receive events. Last edited: Aug 10, 2017 Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Aug 10, 2017 #3 Move the code to a class. Add a public process global class instance to the starter service and initialize it in Service_Create. Upvote 0
Move the code to a class. Add a public process global class instance to the starter service and initialize it in Service_Create.