On Saturday 16 January 2010 01:30:53 pm Jacek Kałucki wrote:
> Użytkownik John napisał:
> > On Saturday 16 January 2010 12:14:46 pm Jacek Kałucki wrote:
> >> Hi,
> >>
> >> How can I enter null/empty date into dDateTextBox?
> >
> > I don't believe you can. Once the control accepts focus it demands a
> > valid date.  I have played with the idea of allowing '<None>' but
> > discovered that I did not require it in the end.
>
> But I must. I have field meaning effective order date,
> which can be filled only when order is really completed.  

I assume that the order date is filled in by the user and not by some program 
trigger.  How about doing something like the following (untested):

bindEvent(dEvents.LostFocus, self.Form._checkDate)

def _checkDate(self,evt):
        """ check if it's a date here OR A STRING"""
   #This gets around it being blank
        start_value = evt.EventObject.Value
        if evt.EventObject.Value == None:
            evt.EventObject.Value = None
            return
     #the user typed in something is it a date or string       
        if not isinstance(evt.EventObject.Value, datetime.date):
            if isinstance(evt.EventObject.Value, basestring):
                evt.EventObject.Value = None 
                evt.EventObject.setFocus()
        return
_______________________________________________
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