How about setting up a property for both on the form and customizing the
setters to update each other...

Something like this perhaps...(Note: Code un-tested, just thought the idea
is feasible

def getfld1val(self)
        try:
                _fld1val=bizobj.getFieldVal("fldname")
        except:
                pass
        return getattr(self,"_fld1val",None)

def setfld1val(self,val)
        _fld1val=val 
        try:
                bizoj.setFieldVal('fldname',val)
        except:
                pass
        _fld2val=1.08*val
        self.fld2obj_regid.update()

fld1val = property(_getfld1val, _setfld1val)

def getfld2val(self)
        return getattr(self,"_fld2val",None)

def setfld2val
        _fld2val=val 
        try:
                bizoj.setFieldVal('fldname',val)
        except:
                pass
        _fld1val=val/1.08
        self.fld1obj_regid.update()

fld2val = property(_getfld2val, _setfld2val)

HTH,
Larry Long

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of freek verstringe
> Sent: Friday, May 22, 2009 5:22 AM
> To: [email protected]
> Subject: [dabo-users] Synchronized fields
> 
> 
> Dear dabo users,
> 
> I currently ran into the following problem.
> I have two dabo.ui.dTextBox fields, the first one connected 
> to the database, the second should be a multiple (times 1.08) 
> of the first one and is not stored in the database.
> On changing one of both, I want them automatically be correct.
> 
> Moreover, I am working in a form, inherited from the 
> datanav.Form class, and multiple bizobjects are in use.
> I already tried overriding the
>     def afterNext(self):
>         if self.prijsexclID.Value:
>             
> self.prijsinclID.Value=Decimal(str(float(self.prijsexclID.Valu
> e)*1.08))
> 
>     def afterFirst(self):
>         if self.prijsexclID.Value:
>             
> self.prijsinclID.Value=Decimal(str(float(self.prijsexclID.Valu
> e)*1.08))
> 
>     def afterLast(self):
>         if self.prijsexclID.Value:
>             
> self.prijsinclID.Value=Decimal(str(float(self.prijsexclID.Valu
> e)*1.08))
> 
>     def afterPrior(self):
>         if self.prijsexclID.Value:
>             
> self.prijsinclID.Value=Decimal(str(float(self.prijsexclID.Valu
> e)*1.08))
> 
> But its synchronization seems to run one step behind. Am I 
> missing something?
> 
> I also made a small extension of the dabo.ui.dTextBox
> /** begin code
> ******************************************************
> 
> # -*- coding: utf-8 -*-
> import dabo
> dabo.ui.loadUI("wx")
> import FrmBase
> from decimal import Decimal
> 
> 
> class PrijsIncltextbox(dabo.ui.dTextBox):
> 
>   def onKeyUp(self,evt):
>     if self.Value:
>       self.Form.prijsexclID.Value=Decimal(str(float(self.Value)/1.08))
> 
> 
> class PrijsExcltextbox(dabo.ui.dTextBox):
>   def onKeyUp(self,evt):
>     if self.Value:
>       self.Form.prijsinclID.Value=Decimal(str(float(self.Value)*1.08))
> ******************************************************
> end code**/
> 
> 
> Best regards,
> Freagel.
> 
> 
> _________________________________________________________________
> More than messages-check out the rest of the Windows LiveT.
> http://www.microsoft.com/windows/windowslive/
> 
> --- StripMime Report -- processed MIME parts --- multipart/alternative
>   text/plain (text body -- kept)
>   text/html
> ---
> _______________________________________________
> 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/BLU143-W2E64360CF73E740753D0FF
[email protected]
> 

_______________________________________________
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/!~!uenerkvcmdkaaqacaaaaaaaaaaaaaaaaabgaaaaaaaaaafa2fnyupuomnfpiynbeqckaaaaqaaaaodqzvfojv0uof0j9umbecweaa...@charter.net

Reply via email to