On Apr 29, 2009, at 6:48 AM, Sibylle Koczian wrote:

> in my application I've got a dDateTextBox connected to a data field
> which is NULL when the application starts and which is then filled in,
> usually with a date some days past. This works correctly (the right  
> day
> gets into the database table), if I enter the date directly, not using
> the shortcuts. It works correctly if I enter 'T' and then '-' as often
> as necessary.
>
> But if I enter 'C' to open the popup calendar and choose the day  
> there,
> then I get the chosen date into the dDateTextBox, but the current date
> into the database table.


        Sorry for the delay; I know that a fix has already been posted. But  
I'm running this with the dDateTextBox.py from before the fix, and I'm  
not seeing this behavior. When I changed the null value using the  
calendar, it correctly displays and saves the value specified in the  
calendar, not the current date. I put debug statements into  
flushValue(), and verified that it was correctly called with the  
correct value when I either tabbed away from the field, or even just  
pressed Cmd-S to save - activeControlValid() correctly called  
flushValue().

        My guess is that the problem is a Gtk issue with focus, and that  
activeControlValid() is not finding the textbox as the active control.  
Would you have the time to do the following: revert dDateTextBox.py to  
r5194, and then modify dFormMixin.py as follows:

237 def activeControlValid(self):
238     """ Force the control-with-focus to fire its KillFocus code.
239
240     The bizobj will only get its field updated during the control's
241     KillFocus code. This function effectively commands that update to
242     happen before it would have otherwise occurred.
243     """
244     ac = self.ActiveControl
        print "ACTIVE CONTROL", ac,
        try:
                print ac.Value
        except:
                print
245     if ac is not None and isinstance(ac,  
dabo.ui.dDataControlMixinBase.dDataControlMixinBase):
246             if not hasattr(ac, "_oldVal") or (not ac._oldVal) or  
(ac._oldVal != ac.Value):
247                     return ac.flushValue()
248     return True

        Then run the example you gave that saves the wrong value, and when  
you save the form, let me know what gets printed out.


-- Ed Leafe



_______________________________________________
Post Messages to: Dabo-users@leafe.com
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/11da11e1-d122-4722-a17b-fd14806d0...@leafe.com

Reply via email to