[Gambas-user] Issue 199 in gambas: LostFocus & Leave events not activated for ValueBox

gambas at ...2524... gambas at ...2524...
Fri Jan 20 08:04:22 CET 2012


Status: New
Owner: ----
Labels: Version Type-Bug Priority-Medium OpSys-Any Dist-Any Arch-Any  
Desktop-Any GUI-Any

New issue 199 by john.aaron.rose at ...626...: LostFocus & Leave events not  
activated for ValueBox
http://code.google.com/p/gambas/issues/detail?id=199

I have a problem with validating a user-entered value in a ValueBox. I've
tried LostFocus & Leave and neither seems to do the validation i.e. no  
Print "Latitude Validation" executes and no message box appears for  
incorrect values. Looks like a bug.

So I thought that I would try Change, even though the documentation says  
that it is raised on each character typed in (rather than at the end of  
typing in the changes to the value) which would not be any good. However,  
I'm not able to use the Change event (i.e. not in popup menu for event and  
has no effect at runtime) for a Valuebox: looks like another bug.  I've  
tried using KeyRelease, but that applies to each character change, so that  
it rejects the value as each character is entered. PS Should I log this as  
another issue?

Code fragment is:
Public Sub ValueBoxLatitude_LostFocus()
   Dim latitude As Float
   Dim i As Integer
   Print "Latitude Validation"
   latitude = Last.Value
   If latitude < -90 Or latitude > 90 Then
     Message.Info("Must be between -90 and +90 - try again")
     Last.SetFocus
     Stop Event
   Endif
   i = CInt(latitude * 1000000)
   Print "CInt(latitude * 1000000)=", i
   If (latitude * 1000000) - CFloat(i) <> 0.0 Then
     Message.Info("More than 6 decimal digits - try again")
     Last.SetFocus
     Stop Event
   Endif
End

Version: 3.0
Operating system: Linux
Distribution: Ubuntu 10.04
Architecture: x86
GUI component: GTK+ (as I haven't specified the GUI)
Desktop used: Gnome2

Project attached.

Database attached.



Attachments:
	JewishHeritage.tar.gz  29.4 KB
	JewishHeritage.db  8.0 KB





More information about the User mailing list