[Gambas-user] Check on entered number having more than 6 digits not working
John Rose
john.aaron.rose at ...626...
Sun Aug 12 09:09:06 CEST 2012
Jussi,
I've put the code below into the Fmain class in that Test project and it
works OK! The Test project needs a lot more code in order to obtain the
Latitude from the database. I'll check it out again with the full
project.
Public Sub ValueBoxLongitude_KeyRelease()
If Key.Code = Key.Return Or Key.Code = Key.Enter Or Key.Code = Key.Tab
Then
ButtonExit.SetFocus()
Endif
End
Public Sub ValueBoxLatitude_LostFocus()
Dim latitude As Float
Dim f As Float
Dim g As Float
If IsNull(Last.Value) Then Return
latitude = Last.Value
If latitude < -90 Or latitude > 90 Then
Message.Info("Must be between -90 and +90 - try again")
Last.SetFocus()
Stop Event
End If
f = latitude * 1000000
g = CFloat(CInt(f))
Print "f=" & f
Print "g=" & g
If f <> g Then
Message.Info("More than 6 decimal digits - try again")
Last.SetFocus()
Stop Event
End If
ButtonExit.SetFocus
End Sub
More information about the User
mailing list