Uwe Grauer wrote: > Paul McNett wrote: >> Paul McNett wrote: >>> Sibylle Koczian wrote: >>>> self.Choices = ["unknown"] + names >>>> self.Keys = [0] + pks >>>> >>>> That works, now "unknown" is selected and the info log message disappears. >>>> But >>>> does it really mean a dropdown list must have an entry with key 0, even if >>>> completely artificial? >>> No, but thanks for finding the source of this message (I've been >>> wondering myself). Somewhere we are certainly saying "lst.Value = 0" >>> when in fact we should be saying 'lst.PositionValue=0'. >> I didn't fix whatever something is setting lst.Value to 0, but I did >> clean up listbox behavior when its Value gets set to a non-existent key. >> Now, nothing is selected in that case. >> >> Please try out the latest subversion trunk. >> > > I think if a listbox value is set to an non existing key there should be > a error message. Why should a value for a non existing key should be > unnoticed?
Half of me agrees with you. Actually, I think I agree almost completely however I first wanted to fix the behavior as it was always intended to work. I'd like to make it raise an exception instead of writing to the infoLog, however I'm a bit concerned that we still have issues underneath somewhere: something in Dabo setting the KeyValue to 0, for instance. I guess by raising an exception we'll find that place and fix it, but it may cause some pain for appdevs in the interim. The Keys and Choices get populated by the appdev; the Value either comes from a dataset somewhere, or gets set explicitly in code. I guess I'm also concerned that there can be a disconnect between what the appdev has designed and tested for, and what actually happens when the user is running the app in the field (value coming from a dataset). Showing nothing in the listbox in that case probably does the most correct thing from the user's perspective (users hate those cryptic errors that keep them from working). I think what I can see doing is creating a new exception class, and raising that when the value isn't present in the Keys. Then the appdev could catch that if desired and do what they want. Paul _______________________________________________ Post Messages to: [email protected] 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/[EMAIL PROTECTED]
