First this:
Waiting for debugger to connect...
Program started.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by anywheresoftware.b4a.shell.Shell (file:/C:/Program%20Files%20(x86)/Anywhere%20Software/B4J/Libraries/jDebug.jar) to field javafx.scene.control.TextField.prefColumnCount
WARNING: Please consider reporting this to the maintainers of anywheresoftware.b4a.shell.Shell
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
I just wanted to develop an equivalent to the old HP BASIC ANGLE(X,Y) function using B4J. This function returned ArcTan2 in the correct quadrant such that -π < θ <= π. I used the designer to build a very simple form - two input TextField views for X and Y, two Buttons, and two output TextField views to show in one ATan2D and the other one to show ANGLE from my code, in order to compare results.
First problem was a crash because I had not initialized the TextField views, which I did not think was necessary as I had generated the required entries into the Main module. Once I had manually initialized them the program ran, but was not reading the text from the TextField views.
It couldn't be much simpler than this (although it could be a lot less verbose) so I suspect I have made an idiot blunder somewhere - this is the first time I have used B4J (V. 7.51).
Waiting for debugger to connect...
Program started.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by anywheresoftware.b4a.shell.Shell (file:/C:/Program%20Files%20(x86)/Anywhere%20Software/B4J/Libraries/jDebug.jar) to field javafx.scene.control.TextField.prefColumnCount
WARNING: Please consider reporting this to the maintainers of anywheresoftware.b4a.shell.Shell
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
I just wanted to develop an equivalent to the old HP BASIC ANGLE(X,Y) function using B4J. This function returned ArcTan2 in the correct quadrant such that -π < θ <= π. I used the designer to build a very simple form - two input TextField views for X and Y, two Buttons, and two output TextField views to show in one ATan2D and the other one to show ANGLE from my code, in order to compare results.
First problem was a crash because I had not initialized the TextField views, which I did not think was necessary as I had generated the required entries into the Main module. Once I had manually initialized them the program ran, but was not reading the text from the TextField views.
It couldn't be much simpler than this (although it could be a lot less verbose) so I suspect I have made an idiot blunder somewhere - this is the first time I have used B4J (V. 7.51).
B4X:
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private txtXUnits As TextField
Private txtYUnits As TextField
Private Label1 As Label
Private Label2 As Label
Private Button1 As Button
Private Button2 As Button
Private txtATan2D As TextField
Private txtAngle As TextField
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
MainForm.RootPane.LoadLayout("AngleTest") 'Load the layout file
MainForm.Show
txtXUnits.Initialize("txtXUnits")
txtYUnits.Initialize("txtYUnits")
End Sub
Sub Button2_Click
End Sub
Sub Button1_Click
Dim xUnits As String
Dim yUnits As String
xUnits = txtXUnits.Text
yUnits = txtYUnits.Text
Dim dblX As Double
Dim dblY As Double
If IsNumber(xUnits) Then
dblX = xUnits
Else
dblX = 0
End If
If IsNumber(yUnits) Then
dblY = yUnits
Else
dblY = 0
End If
Dim Tangent2 As Double = ATan2D(dblY, dblX)
Dim strTan2 As String = Tangent2
txtATan2D.Text = strTan2
txtAngle.Text = strTan2 'This last line to put a break-point on to inspect variables
End Sub