'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
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 equationmaxpower As EditText
Dim findrootButton As Button
Dim maxpowr As Double
Dim coEfficient As Double
'Dim resultss As Double
Dim i As Double
Dim cofx() As Double
Dim coDfx() As Double
Dim a As Double
Dim maxpowrDfx As Double
Dim pn As Panel
Dim btnNext As Button
Dim coEfficientText As EditText
Dim coEffCounter As Int
End Sub
Sub Activity_Create(FirstTime As Boolean)
equationmaxpower.Initialize ("")
Activity.AddView (equationmaxpower,0,0,50%x,10%y)
findrootButton.Initialize ("findrootButton")
findrootButton.Text="set coeff"
Activity.AddView (findrootButton,0,20%y,50%x,10%y)
pn.Initialize ("pn")
btnNext.Initialize ("next")
btnNext.Text="Next"
coEfficientText.Initialize ("")
coEfficientText.Text=""
pn.Visible =False
Activity.AddView (pn,0,0,50%x,40%y)
pn.AddView (coEfficientText,0,0,40%x,10%y)
pn.AddView (btnNext,0,20%y,40%x,10%y)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub findrootButton_Click
If equationmaxpower.Text = "" Then
Msgbox("Insert a value","")
Return
Else
If equationmaxpower.Text = 0 Then
Msgbox("Insert a value more than 0","")
Return
Else
Try
' you don't need this. you've checked already for that above
'If Not(equationmaxpower.Text = "") Then
maxpowr = equationmaxpower.Text
coEfficient = maxpowr + 1
Dim cofx(maxpowr+1) As Double
Dim coDfx(maxpowr) As Double
coDfx(0) = 0
i=0
btnNext.Text="Enter coeff" & (i+1)
pn.BringToFront :pn.Color=Colors.Blue
pn.Visible =True
coEfficientText.RequestFocus
Catch
Msgbox("enter a number","error")
End Try
End If
End If
End Sub
Sub next_Click
If coEfficientText.Text = "" Then
Msgbox("Insert a value","")
Else
Try
cofx(i)= coEfficientText.Text
If i<maxpowr-1 Then
coDfx(i)=cofx(i)*(maxpowr-i)
End If
i=i+1
If i<=maxpowr Then
coEfficientText.Text=""
coEfficientText.RequestFocus
btnNext.Text="Enter coef" & (i+1)
Else
pn.Visible =False
' from here, proceed to whichever sub you want to go on
' just an example
Dim tempS As String
tempS=""
For j=0 To maxpowr
tempS=tempS & "coeff "& (j+1) & " = " & cofx(j) & CRLF
Next
Msgbox(tempS,"finished")
End If
Catch
Msgbox("enter a number","error")
End Try
End If
End Sub