On Monday, April 25, 2011 03:37:37 pm John Fabiani wrote:
> Hi,
> Apparently one of my users is able to enter invalid dates and tracing this
> bug caused me to check the code for the dDateTextBox.  I was reviewing the
> code when I found this code for LostFocus event
> 
> def __onLostFocus(self, evt):
>               val = self.Value
>               try:
>                       newVal = self.Value
>                       if newVal != val:
>                               self.Value = newVal
>               except ValueError:
>                       pass
> 
> 
> Looks like it does nothing.  How could it be possible that the newVal !=
> val????  If it doesn't the self.Value is reset.
> 
> What is the purpose of the code???  Was it required for some special
> purpose? Johnf

This really bugs me!  
The first "val = self.Value" uses the dTextBoxMixin property getter 
_getValue().  A few ms later it does the same thing for a new variable 
"newVal".  What I don't understand is what and why would it change between the 
calls.

Ed you wrote this back in 2007 and I know you don't write code just to write 
code.  I don't understand how it works or what it does.  Could you explain 
please.   



Johnf
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to