T texwillerx Member Licensed User Longtime User Oct 27, 2012 #1 I use a class in my code (clstrs). It contains lots of variables in class_globals. I use this class as dim trs as clstrs I can only declare this in globals module and not in process_globals. I want to declare this in process_globals so that all the variables in the class will keep their values during the process life cycle, i. e. I don't want them to be initialized for each activity create/resume. Is there a solution for my problem? Thanks in advance Talat Oncu
I use a class in my code (clstrs). It contains lots of variables in class_globals. I use this class as dim trs as clstrs I can only declare this in globals module and not in process_globals. I want to declare this in process_globals so that all the variables in the class will keep their values during the process life cycle, i. e. I don't want them to be initialized for each activity create/resume. Is there a solution for my problem? Thanks in advance Talat Oncu
margret Well-Known Member Licensed User Longtime User Oct 27, 2012 #2 if you use or reference an activity object in the class you will only be able to dim it in Globals. If you remove all Activity objects you should be able to declare it as Process_Globals. Upvote 0
if you use or reference an activity object in the class you will only be able to dim it in Globals. If you remove all Activity objects you should be able to declare it as Process_Globals.
T texwillerx Member Licensed User Longtime User Oct 27, 2012 #3 Thank you very much for your reply. I use the followings ByteConverter ArraysExtra RandomAccessFile SQL Cursor Are these activity objects? Also I use procedures from some libraries (e. g. instr, mid from stringsubroutines and some functions from my subroutine libraries). Are these considered as activity objects? Thanks Talat Upvote 0
Thank you very much for your reply. I use the followings ByteConverter ArraysExtra RandomAccessFile SQL Cursor Are these activity objects? Also I use procedures from some libraries (e. g. instr, mid from stringsubroutines and some functions from my subroutine libraries). Are these considered as activity objects? Thanks Talat
margret Well-Known Member Licensed User Longtime User Oct 27, 2012 #4 In the Initialize sub in your class, are you getting the Activity? This may be the issue. You can look at this class, it can be Dimmed in Process_Globals or in Globals: http://www.b4x.com/forum/additional-libraries-classes-official-updates/22118-class-databases.html Upvote 0
In the Initialize sub in your class, are you getting the Activity? This may be the issue. You can look at this class, it can be Dimmed in Process_Globals or in Globals: http://www.b4x.com/forum/additional-libraries-classes-official-updates/22118-class-databases.html
T texwillerx Member Licensed User Longtime User Oct 27, 2012 #5 I am really sorry but I didn't understand what you mean by "In the Initialize sub in your class, are you getting the Activity". Would you please explain this a little bit. Thanks a lot Talat Upvote 0
I am really sorry but I didn't understand what you mean by "In the Initialize sub in your class, are you getting the Activity". Would you please explain this a little bit. Thanks a lot Talat
margret Well-Known Member Licensed User Longtime User Oct 27, 2012 #6 In your class you have something like: Code: Copy Private Sub Class_Globals 'Your dimmed vars here End Sub Public Sub Initialize(ActivityModule As Object, mAct As Activity) 'Your initialize code here End Sub So what does your Inintialize sub line look like? Code: Copy Public Sub Initialize(ActivityModule As Object, mAct As Activity) Can you post your class Initialize sub? Upvote 0
In your class you have something like: Code: Copy Private Sub Class_Globals 'Your dimmed vars here End Sub Public Sub Initialize(ActivityModule As Object, mAct As Activity) 'Your initialize code here End Sub So what does your Inintialize sub line look like? Code: Copy Public Sub Initialize(ActivityModule As Object, mAct As Activity) Can you post your class Initialize sub?
T texwillerx Member Licensed User Longtime User Oct 28, 2012 #7 OK, I found the problem: In order to track what is happening in the class module, I passed a Label parameter to the Inıtialize sub and save this value to a Label variable which is defined in Class_Globals. When I deleted this declaration and all references to it, I was able to declare this class in process_globals. Now, I need help in another point: How can I pass some messages from class module to the activity module so that these messages are displayed in a Label, so that I can track the execution of the class module: Thank you for your extremely valueable help. Regards Talat Last edited: Oct 28, 2012 Upvote 0
OK, I found the problem: In order to track what is happening in the class module, I passed a Label parameter to the Inıtialize sub and save this value to a Label variable which is defined in Class_Globals. When I deleted this declaration and all references to it, I was able to declare this class in process_globals. Now, I need help in another point: How can I pass some messages from class module to the activity module so that these messages are displayed in a Label, so that I can track the execution of the class module: Thank you for your extremely valueable help. Regards Talat
margret Well-Known Member Licensed User Longtime User Oct 28, 2012 #8 In your class use the code below and put it where you need it. MyModule is a variable holding the name of the calling Activity. Subname is the name of your sub in the Activity. The second block is how MyModule got it's value. Code: Copy If SubExists(MyModule, "SubName") Then CallSub2(MyModule, "SubName", "your message here") End If Code: Copy Public Sub Initialize(Module As Object) MyModule = Module End Sub Last edited: Oct 28, 2012 Upvote 0
In your class use the code below and put it where you need it. MyModule is a variable holding the name of the calling Activity. Subname is the name of your sub in the Activity. The second block is how MyModule got it's value. Code: Copy If SubExists(MyModule, "SubName") Then CallSub2(MyModule, "SubName", "your message here") End If Code: Copy Public Sub Initialize(Module As Object) MyModule = Module End Sub
T texwillerx Member Licensed User Longtime User Oct 29, 2012 #9 Thank you very much for your help. The code worked perfectly. Regards. Talat Upvote 0