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

Author: Paul McNett

Posted: 2009-07-27 at 01:21:48

Ed Leafe wrote:

> On Jul 26, 2009, at 11:30 PM, Paul McNett wrote:

>

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

>> and

>> listbox.Keys are set?

>

>

> I think so, but I'm not sure that this is the cause in all the cases

> that have been reported. But it does seem that in many cases the code

> is populating the list, but they are still getting the 'value not in

> list' error.

>

>> 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?

>

>

> I don't think it would be that simple, since we also have DataSource

> and DataField, which indirectly set Value, too. That's why I thought

> handling the first error with a delay, and only if it fails in the

> setAfter() attempt do we treat it like an actual error.

Well, it could be:

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

However, your idea sounds easier to implement. Want to give it a go?

Paul

©2009 Paul McNett