On Sunday, November 14, 2010 09:19:03 am Carey Gagnon wrote:
> > My app goes one step further in that I can add clients (builders in my
> > case) , which are added via a child form launched from the main form.
> > When I close the child form how do I update the dropdownlist?
> >
> > from the parent form:
> >
> > ## *!* ## Dabo Code ID: dButton-dPanel
> >
> > def onHit(self, evt):
> > self.Form.newRecordBuilder()
> >
> > def newRecordBuilder(self):
> > dabo.ui.createForm("frmBuildersAdd.cdxml", show=True, parent=self)
> > self.hide()
> >
> > back to the parent from the child:
> >
> > def closeProgram(self,evt):
> > self.openBuildersForm = True
> >
> > self.close()
> >
> > def beforeClose(self, evt):
> > if self.openBuildersForm:
> > self.Parent.show()
> >
> > Thanks
> > Carey
>
> Ok...my 1st question can be ignored. Adding:
> def afterSave(self):
> # This will only get called if the save succeeds
> self.requery()
> Now updates the grid with the new value.
>
> Could still us some help on updating the dropdown list however.
>
> Thanks
> Carey
OK you found a solution to the first problem.
The dropdown choices are static. In most cases this works well because most
dropdowns use static list - like US states. But in this case you have to
update the dropdown. The way I have been successful is to create a new class
for my dropdowns. In the new class I override the update method like below.
So when an update occurs my dropdown is updated.
class CourseDropDown(dabo.ui.dDropdownList):
def update(self):
self.removeAll()
self.Choices,self.Keys = self.Form.courseChoices()
self.super()
"self.Form.courseChoices" is a method that retrieves the data.
And this is how I create the control on the form.
courselist=CourseDropDown(self, Width = 500, ValueMode = 'key', RegID =
'courseID', DataSource = "public.esenroll", DataField = "fk_escourse")
I don't recall how to add a new class to ClassDesigner and how to use it. But
I think Ed provided a way to get this done.
As always maybe this is not the best way and anyone can correct me.
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]