Another Forum area for B4X?

I know most of the discussion here is Xojo related, but I do wonder if we might benefit by actively discussing B4X, with a new category.

I’m in the early stages and would quite like a place to discuss CURRENT good practice and tips.

1 Like

Mixed feelings. I kind of like the idea of having a forum discussing solutions (which may start with one tool, but may or may not end with another because of a better solution).

B4X does not really need a separate forum, as Erel from the official B4X forum does not act like the moderators on the official Xojo forum do (and I thought this was the main reason for this forum, being allowed to discuss everything, without the risk of being banned or posts deleted?).

Erel is even a member here.

1 Like

Even a bit afraid this would lead to a Xojo vs B4X vs XYZ battle. As it is now, we are all cross platform devs (tool independent).

As it is now, we are all cross platform devs (tool independent).
I love this sentence !

Back to OPQ:
This is an idea: how to start using B4X and more (with time) for those who want to move.

Do you mean like some kind of ’ I Wish I Knew How to… move to B4X’ book? If so, we do have probably the best book writer aboard this forum @eugenedakin :innocent:

I stick to my earlier position however: the point of this forum shouldn’t be that. All platforms equal and all have a right to exist. No need to push someone one direction or another.


Not a fan of the idea, B4X forum is great, most of the tutorials have a Note at the top if they are deprecated with a link to the CURRENT good practice.

You just have to use to the search function of the forum

I think having a B4X area is a good idea. I’d also like a PHP area. Don’t worry about code wars.

that all runs the risk of segmenting the population of this forum

1 Like

Thanks for the kind words.

Writing a book on B4X is a strong possibility, and I have a few basic questions, and pardon my naive questions

  1. does B4X have the ability to do multicore multiprocessing? Xojo can’t do this and my desktop programs are becoming painfully slow.
  2. you are great at graphics, and can B4X do high performance graphics for games and/or virtual reality? Again, Xojo can’t do this and I have a few clients who want this graphical option.
  3. does B4X support graphic languages such as DirectX and Vulkan?
  4. I am guessing that B4X likely supports all the common databases right? (Postgresql, sqlite, etc)
  5. does B4X support cameras on Windows? I could only find legacy support for cameras with Xojo on Windows.
  6. can an exe be created by B4X so that my app can be portable and sold on Microsoft store?
  7. I am a Raspberry pi fanatic, and I am guessing that B4X supports I/O for the Raspberry OS with electronics?

I greatly appreciate your thoughts. :slightly_smiling_face:

from the b4x site
“JavaFX uses hardware acceleration automatically if the display driver is supported. There is no simple way to use OpenGL or DirectX with JavaFX (and B4J). It might be better supported once JavaFX 8.0 is released.” (this from 2014)

’ JDBCSQL Connector/J - Connect directly to MySQL, MSSQL, PostgreSQL, MariaDB and Oracle databases’

iMedia library v1.10 includes a new type of object named LLCamera. LLCamera provides low level camera access, similar to B4A Camera library. If you just want to allow the user to take a picture then it will probably be better to use Camera instead of LLCamera.


'When you compile in Release mode the complete app is packed as an executable jar file.

You can distribute this jar file and run it on Windows, Mac or Linux.

However there are cases where you want to convert this jar file to a native executable. For example if you want to set a custom icon.

You can use a free tool named Launch4j to convert the jar file to a native Windows executable.

PI outputs:

1 Like
  1. Many things in B4X (not talking about B4R here) are executed in the background with background threads. With the exception of server solutions, the B4X code always runs on the main thread. Libraries can easily run tasks on background threads, there is a built-in thread pool in the framework.
    Stuff like communication, database operations, file operations and others include async APIs.

It is not exactly related but it is very important for B4X developers to become familiar with resumable subs.
It allows developers to run async code in almost the same way you run regular synchronous code.
For example:

Wait For JobDone 'not the exact syntax
'Work with result

Overall the performance of B4X is very good. Tip: never test performance in debug mode. It will be much slower.

  1. Not really. You can create 2d games with XUI2D:
  2. No.
  3. True.
  4. B4A and B4i can of course do many things with the cameras. It is quite simple to access native libraries (Java in the case of B4J) so if you find a Java library for this, it will not be too complicated to use it from B4J. A quick search revealed this library:
    I never tried it myself.
  5. Creating a standalone executable with B4J, is very simple. Don’t use the old Launch4j tool. Use the built-in packager:
    The result package size will be about 35mb without WebView or 50mb with it. The size comes from the embedded JRE.
    Note that the sizes of B4i IPA or B4A APK are very small. The framework will add about 400kb.
  6. Yes. Search for Pi4J.

Thanks for the great and informative response Erel! :slight_smile:

1 Like

As for the the Vulkan/DirectX question, maybe this lib could be wrapped for B4X:


Just did a quick proof of concept and I think the LWJGL lib would be doable to wrap. It would take a typing enthusiastic to write the wrap methods, but not difficult at all. :smiley:

@eugenedakin This code will probably make sense to you, but as I don’t know OpenGL I just translated an existing demo.

I guess the same would be possible to do for Vulkan, and this lib does support that.

1 Like

Thank you for the demo.

Yes this makes alot of sense. I am honestly amazed at how many open and free libraries there are for Java/B4X (etc). Since the library (or even part of a library) exists for vulkan/OpenGL, the this is very doable in B4X.

I was contemplating writing a wrapper for Vulkan in Xojo, but the work involved was large. Xojo’s graphical performance is poor (at best), and unstable on Windows - crashing, memory issues, etc. Lol, of course I found this out the hard way when I wrote the OpenGL book for Xojo.

Writing a wrapper isn’t that hard (like the one I did for pigpio on the Raspberry Pi) wasn’t that hard, it just required time and a very organized plan, along with example documentation to make it practical in the real world.

The stumbling block that I keep running into with Xojo is poor performance on Windows, and every other language I tried (C++, C, C #, even Visual Basic) were all perfectly fine for performance. Admittantly, I have not tried Java yet and you have piqued my interest.

Alain and Erel, thanks for your helpful answers to my questions. I am going to give B4X some serious thought for my next project and/or book.

Just contact me if you need help with getting started wrapping this (or another) lib for B4X. I can provide you with a starting project in Eclipse and then you can add as you see needed.

1 Like

Just for fun, I counted up the number of books that I wrote, and there were a total of 33 books published, with the largest book being Windows API declares at over 1,000 pages. Some of the books have been retired. Chuckle, I wouldn’t say that I am the best book writer, but I likely fit into the category of the most-books written. Time flies when your having fun :slightly_smiling_face:

1 Like

Quite the achievement!

I agree. Since most people here use or used Xojo, a guide to transitioning from Xojo to B4J and B4i would be great. Things like displaying windows (does it use implicit instances?), modal windows, custom messagebox with return value(s), global variables (gotchas, best practice), creating classes and subclassing existing classes and controls, etc.