On Tuesday, August 16, 2011 04:36:40 pm Paul McNett wrote:
> On 8/15/11 12:38 PM, Paul McNett wrote:
> >> >  that's my point.  I'd like to use the field as a flag as part of a
> >> >  series of flags (even considered a state machine).  But now I need a
> >> >  field to tell me if there were any changes.
> > 
> > def isFieldChanged(self, field_name, row=None):
> >     return self.getFieldVal(field_name, row) != self.oldVal(field_name,
> >     row)
> 
> ...and if you want to find out, without asking, at the time a field value
> changes, something like this should work:
> 
> class FieldValueChanged(dabo.dEvents.dEvent): pass
> 
> class MyBizobj(...):
>    def afterSetFieldVal(self, fld, row):
>      self.raiseEvent(FieldValueChanged, table=self.DataSource, field=fld,
> row=row)
> 
> class MyForm(...):
>    def afterInit(self):
>      ...
>      self.bindEvent(FieldValueChanged, self.onFieldValueChanged)
> 
>    def onFieldValueChanged(self, evt):
>      table = evt.EventData.table
>      field = evt.EventData.field
>      row = evt.EventData.row
>      # do stuff to visually indicate the change
> 
> (untested but you get the gist)
> 
> Paul

That's a lot better than what I came up with - I'll see if I can get it 
working.

Thanks
Johnf
_______________________________________________
Post Messages to: Dabo-users@leafe.com
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/201108161701.17737.jo...@jfcomputer.com

Reply via email to