Wish Include directive or new module type for x-platform code

nwhitfield

Active Member
Licensed User
Longtime User
It's becoming very easy now to create apps that work on both iPhone and Android, with XUI and other b4x libraries.

However, when it comes to handling the events, I now find that there are some things - displaying an XUI dialog box, for example, and getting the info back from the choices it provides to the user - that are exactly the same code on both platforms.

But, if it's handling events, it can't be in a static code module shared between b4i and b4a. As a result, I end up copying and pasting a lot of code between the two IDEs. You can get round some of this by creating new classes, but not all.

So, I think it would be good to have either the equivalent of a #include directive or - probably more in keeping with the way the IDE works at the moment - an 'Additional Main' module type, which can be added to a project, and shared across projects, which is effectively just appended to the real Main module at compile time.
 

nwhitfield

Active Member
Licensed User
Longtime User
OK; forgive me if I'm being dense here; I can see how I could instantiate a UI class, for instance, that might have things like XUI dialogs in it, and so the events would come back to the class module.

But what about items in layout files? If those are added to a panel in the Main module, won't their events also be raised there?
 
Top