Android Question Confused about object types: B4J vs B4A

jacksonmacd

New Member
B4X newbie here. I've worked my way thru the first part of B4X Getting Started V2.4, and have the MyFirstProgram working on my Windows 11 computer. Next step is to try the same program in B4A. I am into step 3.3.3 where it will not run as per instructed on p.45. That's when I noticed there are some error messages on the B4XMainPage, and a red squiggly underline on this line:

Private edtResult as TextField

TextField is not one of the IntelliSense items of available types. TextReader and TextWriter are available, but not TextField

The error message states that edtResult is undeclared.

So I go back to B4J and notice the program still runs successfully, however, there is an error message: "com.sun.javafx.embed.swing.oldimpl not in javafx.swing"
A search through the forums states this is a harmless message that can be safely ignored.
My computer does not have a javafx.swing.oldimpl file, but it does contain a file named javafx.swing.jmod. Not sure if this is significant, but they seem related.

I'm confused: I thought that the source code was interchangeable between the platforms, but a Type that works in B4J is not working in B4A.

Can anyone point me in the right direction to fix this. What type do I use for the edtResult in the B4A example?
TIA
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can write cross platform code with B4X, however you aren't limited to cross platform. On each platform you get access to all the native features (the meaning of "native" depends on the specific platform).

Best to start with the cross platform guide: https://www.b4x.com/android/documentation.html

With that said, change TextField with B4XView and it will work. B4XView is a generic type that works with most native views.
I also recommend you to check XUI Views. You can for example use B4XFloatTextField which is cross platform and adds useful features to the native text field.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
The B4X Getting started booklet edition 2.5 has been updated, beginning with a B4XPages cross-platform project instead of mono-platform projects.
It will be published when the next B4i update will be published.
 
Last edited:
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
B4X newbie here. I've worked my way thru the first part of B4X Getting Started V2.4, and have the MyFirstProgram working on my Windows 11 computer. Next step is to try the same program in B4A. I am into step 3.3.3 where it will not run as per instructed on p.45. That's when I noticed there are some error messages on the B4XMainPage, and a red squiggly underline on this line:

Private edtResult as TextField

TextField is not one of the IntelliSense items of available types. TextReader and TextWriter are available, but not TextField

The error message states that edtResult is undeclared.

So I go back to B4J and notice the program still runs successfully, however, there is an error message: "com.sun.javafx.embed.swing.oldimpl not in javafx.swing"
A search through the forums states this is a harmless message that can be safely ignored.
My computer does not have a javafx.swing.oldimpl file, but it does contain a file named javafx.swing.jmod. Not sure if this is significant, but they seem related.

I'm confused: I thought that the source code was interchangeable between the platforms, but a Type that works in B4J is not working in B4A.

Can anyone point me in the right direction to fix this. What type do I use for the edtResult in the B4A example?
TIA

In B4J its Textfield, but when you are in B4A you have to Replace the Textfield in the layout with EDITTEXT

But it seems you are using B4XPages so its BEST you declare as B4XView (Check also B4XFloatextfield from XUI Views Library)
 
Upvote 0
Top