>I recently had a similar problem - what I think is missing is a
>self.requery() in the afterInit of your form. This is because the error is
>caused by a mismatch between the data type initially in the field (if no
>requery this is an  empty 'unicode' field, with a requery it is whatever is
>read from the database), and then when the next value goes in it is a date
>(which doesn't match). Seems to me to be a dabo inconsistency - the initial
>field type should be set to what is in the data structure if it exists.

I had a call to self.requery() in the afterInitAll method of the form. I
placed the call in the afterInit method instead, without any effect. If I
look in the datastructure of the bizobj, the info about the field is:

('eintritt', 'D', False, 'public.ma', 'eintritt', None)

I guess this looks correct, right?

Ed wrote:

>It could be considered a bug or a "not yet implemented" feature,  
>depending on your point of view.

>The issue is that dMaskedTextBox, like all wx text controls, only  
>work with string-type values; it can't work with dates, datetimes,  
>integers, floats, etc. Our regular dTextBox class does a lot of fancy  
>behind-the-scenes stuff to track the original type, convert it to text  
>for display, and then convert back to the original type when writing  
>back to the database. That logic is not yet in dMaskedTextBox; it only  
>works with text.

Hmm, doesn't this contradict what John Fabiani said?

> I worked on the class about three months ago and I don't recall issues with
> dates.

John, did you use dMaskedTextBox with a real database date field?

Anyway, I tested some more:

>You have subclassed the dabo UI.  I'd first test the code using standard Dabo
>classes (yes I understand that it should work anyway).  I'd start with
>dDateTextBox and then move on to dMaskTextBox.  

>"Failed to save" suggest that there is something wrong with the either the
>bizobj description or the data.  The fact that it is asking to save may have
>something to do with dMaskTextBox (because the data is changed from the mask-
>also there has something to do with the default dates being changed).  But
>before we get to that please test dDateBox.  If dDateBox works then test
>dMaskTexBox with no ValueMode.  Let us know the results.

As you suggested, I used the dabo.ui.dMaskedTextBox directly, instead of
subclassing it. The problem persisted.

If I use a dTextBox for the date field, everything works fine.

If I use a dDateTextBox, normal editing works. But the calendar feature of
the widget doesn't work right: if I double click or push "c", the calendar
pops up and lets me select a date and I can see the selected date in the
widget. But it is impossible to save that new value: as soon as I save or
navigate to a another record, the value of the fields gets reverted
to the original value. Any idea what causes that?

Best Regards

Peter
-- 
Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL 
für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a

_______________________________________________
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