Android Question Code problem

Shelby

Well-Known Member
Licensed User
Longtime User
Once again I'm confused when working with an Erel tutorial (Dynamic Controls) and my B4A won't react like his B4J. In the following code B4A won't recognize a Form and I don't know how to either declare Form or find a B4A library which will allow Form. Please help.
Thanks

I get this message when running the IDE Debug.

B4A Version: 7.80
Parsing code. Error
Error parsing program.
Error description: Unknown type: form
Are you missing a library reference?
Error occurred on line: 4 (Main)
Private MainForm As Form


B4X:
Sub Process_Globals
    Private MainForm As Form
    Private Label1 As Label
    End Sub

Sub Globals
    Private Label1 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Dyno_Layout") 'Load the layout file
    MainForm.Show
End Sub

Sub Button2_Click
    Label1.Text = 2
End Sub

Sub Button1_Click
    Label1.Text = 1
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub
 

LucaMs

Expert
Licensed User
Longtime User
I don't know:
Erel tutorial (Dynamic Controls)

but you are using code written for B4J in a B4A project and this cannot work.

In B4A there are no "forms" but Activities; there are no "panes" but panels.

The code you posted, in b4a is very simple, it is the default code of any new Activity.

You should start watching:
"First B4A App"
https://www.b4x.com/etp.html
 
Upvote 0

Shelby

Well-Known Member
Licensed User
Longtime User
O.K.,
I haven't viewed it. It's next on the tutorial list. I'll watch it now and come back to the Dynamic Controls Tutorial.
Thanks Luca
 
Last edited:
Upvote 0

Sandman

Expert
Licensed User
Longtime User
It's really important to remember that even though B4A, B4i and B4J looks very much each other on the surface, Erel has no intention to make it a single language for all platforms. Instead, each platform has its own ways of doing things, and the different B4*'s tend to follow the platform specific stuff quite closely.
 
Upvote 0
Top