Ed Leafe wrote:
On Friday 12 August 2005 20:10, Paul McNett wrote:


Any chance you can send me an example that shows this problem? What
happens when you instead use a straight dTextBox instead of
dDateTextBox. I ask because it could help us figure out where the
problem is...


Looking at the code some more, I see two very different meanings of a control's 'Value': what is displayed to the user, and what is stored/retrieved from the database. In most cases, these values are identical, but in the case of date/datetime values, they can be very different. The dDateTextBox class has an attribute for internally tracking the date, and it uses that to create the Value that is displayed to the user. The problem, though, is that the Value is not in the format needed by the database, and changes to this date cannot be saved. What do you think about changing the flushValue() method to look for a custom method/property in the control that would return the control's actual underlying value (in this case, the date), and this method would by default simply return the Value. This won't break any existing controls, but it would allow us to decouple the display of a control from the value that display represents. Any feelings pro/con?

Check out the base dTextBox, it already handles that. When code issues dTextBox.Value = date.date(2005,6,3), the textbox's Value is of type date.date, and when the value is changed interactively, it will fail unless the simple date.date(stringvalue) can convert it. What is actually displayed in the textbox is the string representation of the underlying type.

So, what is missing? Custom editors/renderers and/or validators for the different types. But the underlying machinery is sound, I believe.

However, I'm talking about the regular dTextBox, and not dDateTextBox, which I haven't looked at to tell the difference yet.

Run the test of dTextBox.py, and play around with editing the date value to see what it does...

--
Paul McNett
http://paulmcnett.com


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to