On Tuesday 14 July 2009 05:32:22 pm Carey Gagnon wrote:
> Ok....two days have passed and I still can't figure it out. I need a sample
> to study.
> What I am trying to do is take the step by step tutorial (
> http://docs.google.com/Doc?id=dg79jzmg_3x78zkp) and create a form to add
> new clients. I've gotten this far with success.
>
> Now what I want to do on the form is take the dTextBox for adding the state
> and turn it into a dDropdownList for the states. I want to hard code this
> NOT pull it in from the database.
>
> I've tried numerous things to no avail. I've tried the many pointer Larry
> and Ed gave me and can only manage a drop down properly populated with the
> hard coded values. But when I click the save button
> everything is written to the database except for a value for the stateprov
> field of the clients table.
>
> I guess I'm not under standing which of these tips go into which file. What
> goes into my ClientForm-code.py and what goes into my ClientBizobj.py file?
>
> Prior to my previous statements, spoon feeding take me back to a warm fuzzy
> place.
>
> Thanks in advance
> Carey
>
> On Sun, Jul 12, 2009 at 8:35 PM, <[email protected]> wrote:
> > Carey,
> >
> > Sorry, my carriage returns didn't go thru....
> >
> > statesdropdown = dabo.ui.dDropdownList(self,DataSource = ClientBizobj,
> > DataField = "stateprov")
> >
> > choices = []
> > keys = {}
> > for location in locations:
> >        choices.append("%s" % (location['state']))
> >        keys[location["iid"]] = len(choices) - 1
> >
> > statesdropdown.Choices = choices
> > statesdropdown.Keys = keys
> > statesdropdown.ValueMode = "key"
> >
> > Larry

I think I understand what you are attempting to do.  I assume Larry thought 
you were hand coding your form and not using ClassDesigner.

First edit the form (the one you created following the step-by-step tutorial) 
in ClassDesigner.  Select the textbox next to the 'State:' label and delete 
the dTextBox.  Now replace the dTextBox with a dDropDown.  To get that done 
you right click on the empty spot and select a dDropDown (part of 
the 'Display Controls' list).  Now in the "object info"  window (recall you 
have the dDropDown selected) fill in the 'Choices' property with the values 
of the states by clicking on the 'Edit' button on the bottom 
('CA','TX','WA' - note the commas).  Next fill in the "DataSource" property 
with 'clients' and "DataField" property with 'stateprov'.  That should work 
immediately.  

But there are other ways to get this done.  As you learn more you will be able 
create controls along with everything needed other ways.

Feel free to ask more questions if you have trouble.

Johnf




_______________________________________________
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]

Reply via email to