On May 10, 2009, at 4:09 AM, Sibylle Koczian wrote: > I don't think the way to populate the list shown in the wiki is the > right way for this case (or is it?). I tried simply to create the > dropdown list like this: > > dl = dabo.ui.dDropdownList(pn, DataSource="rubrik", > DataField="rub_name") > dl.ValueMode = "String"
The wiki example is primarily designed for foreign key lookups, not for cases like this where you are storing the data directly in the table. One requirement of list controls that we inherit from wxPython is that the value must be an item in the list. When you set DataSource and DataField, it tries to set the value of the control, but you haven't populated the Choices yet, so you get the error you reported. The best way to handle this is to set the DataSource and DataField *after* you have populated the list. So remove those from the constructor code. You can include ValueMode in the constructor; you can also include Choices if you've already determined them. So the optimal code would be: chc = <some method to get available choices> dl = dabo.ui.dDropdownList(pn, Choices=chc, ValueMode="String") dl.DataSource = "rubrik" dl.DataField = "rub_name" -- Ed Leafe _______________________________________________ Post Messages to: Dabo-users@leafe.com 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/d5d8cad0-597f-4c6c-8e91-b289bdcef...@leafe.com