After your excellent work David, may I ask a question or two.
First, a little background, I am new to B4A, and haven't really programmed much for many years. I am writing a programme, initially for my own use to calculate pointing angles for a specific satellite So far I can get my position from the GPS then have the programme calculate the angles. The last piece is to calculate the variation
I have tried following the info from the Basic4PPC library as well as the .xml file from the new library.
The programme I came up with (please don't laugh) is below:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim mg As Magnetics
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim v(3) As Double 'v(0)-Magnetic Declination (OR Variation)
'v(1)-Magnetic Inclination
'v(2)-Grid Variation -
Dim Lat As Double 'Input Latitude
Dim Lon As Double 'Input Longitude
Dim Alt As Double 'Input Altitude
Dim dv As Double 'Used in Variation Calculation
Dim sign As Int 'Used in Sign of Variation Calculation
Dim txtLat As EditText 'Get Altitude
Dim txtLon As EditText 'Get Longitude
Dim txtAlt As EditText 'Get Altitude
Dim Label1 As Label 'Descriptive Text
Dim Label2 As Label 'Descriptive Text
Dim Label3 As Label 'Descriptive Text
Dim Label5 As Label 'Descriptive Text
Dim lblVarDig As Label 'Dispalay Decimal Variation
Dim lblVarDMS As Label 'Dispalay DMS Variation
Dim lblInc As Label 'Dispalay Inclination
Dim lblGV As Label 'Dispalay Grid Variation
Dim btnCalc As Button 'Starts Calculation
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("magtest")
mg.Initialize
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub calc_Click
v() = mg.magneticdata(txtLat.text,txtLon.text,txtAlt.text) 'ERROR LINE
dv = Abs(v(0))
sign = v(0) /dv
lblVarDig.text = Round2(v(0),2) & Chr(176) ' digital
lblVarDMS.text = Floor(dv) & Chr(176) & Round((dv-Floor(dv))*60) & "'" ' DMS
lblInc.text = v(1) ' Inclination
lblGV.text = v(2) ' Grid Variation
End Sub
The error I get, and can't fix is :
Compiling code. Error
Error compiling program.
Error description: Missing parameter.
Occurred on line: 60
v() = mg.magneticdata(txtLat.text,txtLon.text,txtAlt.text)
Word: (
If you have the time could you point me in the right direction?
Also where should WMMC.COF be located, currently I have it in C:\Program Files (x86)\Anywhere Software\Basic4android\
Wooly