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

Author: Miguel Lopes

Posted: 2009-07-27 at 07:38:05

On Mon, Jul 27, 2009 at 5:30 AM, Paul McNett<p@ulmcnett.com> wrote:

> Ed Leafe wrote:

>> =A0 =A0 =A0 Paul, I'm wondering - could we trap this particular error, s=

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

No. I have the problem even considering / respecting that.

This case maybe special because the form is loaded from a cdxml file.

Note that properties are not being set in the class designer (as per

my email above).

In this case dropdownList properties are being set in the afterInitAll

cdxml form method. The code is:

def afterInitAll(self):

_valueListProvider =3D self.Application.getAppInfo('valueListProvider')

vlKeys, vlChoices =3D _valueListProvider.getKeysAndChoices('contact_title'=

)

dropDown =3D self.getObjectByRegID("dlTitle")

dropDown.DataSource=3D"contact"

dropDown.DataField=3D"title_id"

dropDown.Keys =3D vlKeys

dropDown.Choices =3D vlChoices

dropDown.ValueMode=3D"Key" # if both commented runs ok - but not

in 'key' valueMode

dropDown.Value =3D vlKeys[0] # if both commented runs ok - but

not in 'key' valueMode

I started to think the problem might not be order, but comming from

when the bizobj. So I made sure the bizobj is previously created (in

the createBizobj cdxml form method). This had no success.

Miguel

©2009 Miguel Lopes