On Monday 11 May 2009 03:59:20 am Sibylle Koczian wrote:
> Ed Leafe schrieb:
> > 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.
>
> That's what I thought.
>
> >     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.
>
> So the Keys and Choices aren't populated automagically by setting
> DataSource and DataField, right? Thinking this over: that wouldn't work
> for the lookup case, I think.
>
> >     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"
>
> I tried this, and now the dDropdownList is filled correctly, I get no
> error messages - but the parent-child relation doesn't seem to work: the
> grid for the child records always shows the records belonging to the
> first parent record.

I didn't see anything in the code that looked wrong so I would start doing 
some debugging.  

I have a guess that the problem is the dropdown is changing but the record of 
the 'rubrik' is not moving.  So you can prove it.

First open a dShell (contrl-d).  
Check to see if the value of the dropdown is changing.  Most likely it is.
Check CurrentSQL for 'dinge' and make sure that the where is changing or is 
not changing.  At the same time check the 'rubrik' dataset and see if it's 
changing.

If the above proves correct then I would write a little code that fired as a 
result of the dropdown that will set the where clause of either of the two 
tables.  Then requery()



-- 
John Fabiani
_______________________________________________
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/200905110645.52587.jfabi...@yolo.com

Reply via email to