Re: [dabo-users] Setting DropdownList.Value exception

Author: Paul McNett

Posted: 2009-07-27 at 00:30:17

Ed Leafe wrote:

> Paul, I'm wondering - could we trap this particular error, set a flag

> in the object, and then add this to the end of the event loop using a

> setAfter call? The flag would enable us to avoid infinite loops if an

> attempt to set an invalid value was made, but would avoid erroring out

> because of the wrong event order.

The problem stems from setting listbox.Value before listbox.Choices and

listbox.Keys are set?

We've seen similar patterns before (certain properties are better set

before/after certain other ones), in which case I think we need to

define some protocol to put in dPemMixin to determine which properties

to set in which order.

Then in each defined class (dListBox.py, etc.) we could define these needs.

Off the top of my head:

class dListBox.py(...)

...

_prop_order = ["Choices", "Keys", "Value"]

and any props not listed in the _prop_order attribute could get set

before, after, or interspersed with the _prop_order props, but the one

guaranteed thing would be that Value would get set after Keys, and Keys

would get set after Choices.

Would something like this fix this issue?

Paul

©2009 Paul McNett