I iCAB Well-Known Member Licensed User Longtime User Aug 21, 2016 #1 Hi All I am wondering if there is a way to reuse B4A activity code modules with B4I (without having to create a new file). In theory, if I am not mistaken the only difference is in the file header and the rest can be done using #if B4A etc.. Can someone please comment on this Thank you
Hi All I am wondering if there is a way to reuse B4A activity code modules with B4I (without having to create a new file). In theory, if I am not mistaken the only difference is in the file header and the rest can be done using #if B4A etc.. Can someone please comment on this Thank you
Erel B4X founder Staff member Licensed User Longtime User Aug 21, 2016 #2 It is not recommended. They will be converted to regular static code modules when they are saved from B4i. Upvote 0
It is not recommended. They will be converted to regular static code modules when they are saved from B4i.
I iCAB Well-Known Member Licensed User Longtime User Aug 21, 2016 #3 Erel said: It is not recommended. They will be converted to regular static code modules when they are saved from B4i. Click to expand... Erel, do you see any issue in creating a utility that changes the header information in the .bas file. This will allow reusing the activity module as static code module with B4I, and change it back to an activity module later on as needed. For example: Change this Code: Copy Type=Activity Version=5.2 ModulesStructureVersion=1 B4A=true @EndOfDesignText@ #Region Activity Attributes #FullScreen: False #IncludeTitle: True #End Region to Code: Copy Type=StaticCode Version=1.21 ModulesStructureVersion=1 B4i=true @EndOfDesignText@ 'Code module and remove the Globals Section (move to Process_Globals) Is there more to it, than this? Thanks again Last edited: Aug 21, 2016 Upvote 0
Erel said: It is not recommended. They will be converted to regular static code modules when they are saved from B4i. Click to expand... Erel, do you see any issue in creating a utility that changes the header information in the .bas file. This will allow reusing the activity module as static code module with B4I, and change it back to an activity module later on as needed. For example: Change this Code: Copy Type=Activity Version=5.2 ModulesStructureVersion=1 B4A=true @EndOfDesignText@ #Region Activity Attributes #FullScreen: False #IncludeTitle: True #End Region to Code: Copy Type=StaticCode Version=1.21 ModulesStructureVersion=1 B4i=true @EndOfDesignText@ 'Code module and remove the Globals Section (move to Process_Globals) Is there more to it, than this? Thanks again
Erel B4X founder Staff member Licensed User Longtime User Aug 22, 2016 #4 iCAB said: Is there more to it, than this? Click to expand... No. Also note that the B4i=true is not important. I would say that it is mostly safe. Upvote 0
iCAB said: Is there more to it, than this? Click to expand... No. Also note that the B4i=true is not important. I would say that it is mostly safe.
I iCAB Well-Known Member Licensed User Longtime User Aug 22, 2016 #5 Perfect, I'll give it a try. Upvote 0
A affable Member Licensed User Longtime User Sep 24, 2016 #6 iCAB said: Perfect, I'll give it a try. Click to expand... Did you find any issues with doing this iCAB? It sounds like a great workaround, just a pity the switching can't be done with #if B4a and #if B4i conditional compilation. Upvote 0
iCAB said: Perfect, I'll give it a try. Click to expand... Did you find any issues with doing this iCAB? It sounds like a great workaround, just a pity the switching can't be done with #if B4a and #if B4i conditional compilation.
I iCAB Well-Known Member Licensed User Longtime User Sep 28, 2016 #7 affable said: Did you find any issues with doing this iCAB? It sounds like a great workaround, just a pity the switching can't be done with #if B4a and #if B4i conditional compilation. Click to expand... I had to play around a bit with the directives. But it is working perfectly ok for me. I am reusing the same code as is with the help of NotePad++ ( search and replace ), and most likely soon enough I will write a small utility that does this. Last edited: Sep 28, 2016 Upvote 0
affable said: Did you find any issues with doing this iCAB? It sounds like a great workaround, just a pity the switching can't be done with #if B4a and #if B4i conditional compilation. Click to expand... I had to play around a bit with the directives. But it is working perfectly ok for me. I am reusing the same code as is with the help of NotePad++ ( search and replace ), and most likely soon enough I will write a small utility that does this.
A affable Member Licensed User Longtime User Sep 28, 2016 #8 iCAB said: I had to play around a bit with the directives. But it is working perfectly ok for me. Click to expand... Thanks iCAB. I have also got it working, however I discovered you can't even leave a space after the "Type=StaticCode" or it will not work. I include the "find & replace" tips right near the top of the code in comments so I can remember what to swap for b4a and b4i. Only 4 files so its more of a nuisance than time consuming. Upvote 0
iCAB said: I had to play around a bit with the directives. But it is working perfectly ok for me. Click to expand... Thanks iCAB. I have also got it working, however I discovered you can't even leave a space after the "Type=StaticCode" or it will not work. I include the "find & replace" tips right near the top of the code in comments so I can remember what to swap for b4a and b4i. Only 4 files so its more of a nuisance than time consuming.
I iCAB Well-Known Member Licensed User Longtime User Sep 28, 2016 #9 affable said: Thanks iCAB. I have also got it working, however I discovered you can't even leave a space after the "Type=StaticCode" or it will not work Click to expand... I am glad you did get it to work. The biggest challenge for me was not related to search and replace, but instead it was the program flow and variables life cycle. Upvote 0
affable said: Thanks iCAB. I have also got it working, however I discovered you can't even leave a space after the "Type=StaticCode" or it will not work Click to expand... I am glad you did get it to work. The biggest challenge for me was not related to search and replace, but instead it was the program flow and variables life cycle.