"Checkboxes in a Grid"--Is this the title of a horror movie :-D ?
I've been following with interest the discussion of work-arounds for
wonky checkbox action, because I'm experiencing problems with the filter
in the Step-by-Step tutorial.
I've coded the project on my XP Pro SP 3 machine (Python 2.5.2, Dabo
Framework 0.9.2) as per instructions (I think--see attached copy of
HoursForm-code.py).
I've created my own little pair of 'clients' and 'hours' tables in
MySQL. Everything works according to spec up to the addition of the
checkbox-activated filter on the 'Hours' form. The default value for
'billed' in the 'hours' table is 0, so, in order to test the filter,
I've updated one record so that the 'billed' value is 1.
The application launches, showing the data-entry page. I can enter
and save new records. On selecting the 'Summary' page, I see all
records, including the 'billed' one and the new, blank record. On
clicking the checkbox, the 'billed' record vanishes--good!
But wait--the box isn't checked! It has cleared itself. If I click
it again, another record disappears, and the box clears itself again.
This can continue until no record remains. No error appears on the
console during any of this. Only when I return to the data entry page
and hit 'Cancel' do I get an error:
"Cancel failed with response: Invalid row specified: None. RowCount=5"
On hitting the 'Close' button, the 'Do you wish to save?' dialog
pops up (as it should), but the same error message appears on the
console when I hit the 'No' button.
Beside this, there is other weirdness. At least, it seems weird to me
that, in the prop sheet for the checkbox, the 'DataSource' field is not
text--it's a checkbox. What's up with that?
propsheet
In fact, in this prop sheet, we see checkboxes in other unexpected
places, as well.
What's wrong here?
Thanks,
--
# -*- coding: utf-8 -*-
### Dabo Class Designer code. You many freely edit the code,
### but do not change the comments containing:
### 'Dabo Code ID: XXXX',
### as these are needed to link the code to the objects.
## *!* ## Dabo Code ID: dButton-dPage-2
def onHit(self, evt):
self.Form.cancel()
## *!* ## Dabo Code ID: dButton-dPage
def onHit(self, evt):
self.Form.save()
## *!* ## Dabo Code ID: dButton-dPage-55
def onHit(self, evt):
self.Form.close()
## *!* ## Dabo Code ID: dCheckBox-dPage
def onHit(self, evt):
self.Form.filterBilled(self.Value)
## *!* ## Dabo Code ID: dDropdownList-dPage
def afterInit(self):
biz = self.Form.getBizobj("hours")
names, pks = biz.getClients()
self.Choices = names
self.Keys = pks
self.ValueMode = "Key"
## *!* ## Dabo Code ID: dForm-top
def afterInitAll(self):
self.requery()
self.new()
def afterSave(self):
#This is called only if the save succeeds.
self.updateClientName()
self.new()
self.serviceDate.setFocus()
def beforeSave(self):
bizobj = self.getBizobj(self.dataSourceParameter)
# If the bizobj hasn't changed, we want to notify the user
# and abort the save process, so that the new record is
# not added afterwards.
if not bizobj.isChanged():
return "No changes have been made; cannot save."
def createBizobjs(self):
conn = self.Application.getConnectionByName("ConsultHours")
HoursBizobj = self.Application.biz.HoursBizobj(conn)
self.addBizobj(HoursBizobj)
def filterBilled(self, filtered):
if filtered:
self.PrimaryBizobj.filter("billed", False)
else:
self.PrimaryBizobj.removeFilters()
self.update()
def updateClientName(self):
nm = self.ddClient.StringValue
self.PrimaryBizobj.setFieldVal("clientname", nm)
--- StripMime Report -- processed MIME parts ---
multipart/mixed
multipart/alternative
text/plain (text body -- kept)
multipart/related
text/html
image/jpeg
image/jpeg
text/plain (text body -- kept)
---
_______________________________________________
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]