Re: [dabo-users] Very Simple dropdownlist

Author: <lalong1@charter.net>

Posted: 2009-07-12 at 17:01:06

Hello Carey,

When you instantiated the dropdown did you bind it to the bizobj?...ie

something like...

statesdropdown = your_dDropdownList(self, DataSource = bizobject,

DataField = "state_id_field")

Larry Long

> -----Original Message-----

> From: dabo-users-bounces@leafe.com

> [mailto:dabo-users-bounces@leafe.com] On Behalf Of Carey Gagnon

> Sent: Sunday, July 12, 2009 2:31 PM

> To: dabo-users@leafe.com

> Subject: [dabo-users] Very Simple dropdownlist

>

> My apologies if this goes out twice. I posted to the nabble

> forum before realizing I needed to subscribe to the mailing list.

>

> ## As Posted On Nabble ##

>

> 1st off, thanks to the developers of dabo. I'm a n00b to

> python, wxpython and dabo. With the help of this forum and

> the step by step guide I have managed to get everything in

> said guide working as expected. I've even managed some simple

> modifications as I learn dabo et al. There's one modification

> I just can't wrap my head around that I will want to use once

> I start developing my own app.

>

> Here's the problem. In the step by step the input field for

> stateprov is currently set to a dTextBox. I would like to

> change this to a dDropdownList.

> I don't want to set up another db table just to do this (I've

> got populating a drop down from the db down no problem). I

> just want a static drop down list that will add the selected

> state from the drop down list to the stateprov field of the

> client table of the database (MySQL) on save. (one mod I

> managed was an Add Client form)

>

> I've looked at the test in the uiwx/dDropdownList.py file and

> have created the following via the CD. The code is located in

> the ClientAddForm-code.py

> file:

>

> def afterInit(self):

> #def initProperties(self): ## Commented out

> locations = ({"state": "Ak", "iid": 1},

> {"state": "Ga", "iid": 2},

> {"state": "Tx", "iid": 3})

>

> choices = []

> keys = {}

> for location in locations:

> choices.append("%s" % (location['state']))

> keys[location["iid"]] = len(choices) - 1

> self.Choices = choices

> self.Keys = keys

> self.ValueMode = "key"

>

> The drop list with choices displays in the form no problem,

> but when I save to the database the selection is not added to

> the stateprov field.

>

>

> H E L P ! ! !

>

> Thanks in advance

> Carey

>

>

> --- StripMime Report -- processed MIME parts --- multipart/alternative

> text/plain (text body -- kept)

> text/html

> ---

>

[excessive quoting removed by server]

©2009 <lalong1@charter.net>