Given the fun I have had trying to get controls in a .cdxml bound to something
other than self.something, I figured a simple example would be good. and of
course I can't get that to work either. Below is what I thought would work,
plus setting the RegID cuz that was the last thing Ed told me to set, but I
have
no idea what to set it to.
Also, from what I gather, the DataSource/Field descriptions are a bit
'restricted' or maybe I don't understand what a dataset is.
DataField: Specifies the data field of the dataset to use as the source of data.
DataSource: Specifies the dataset to use as the source of data.
This description doesn't help me much:
RegID: Placeholder for the actual RegID property
Here is my code and cdxml (which is nice and small now. Ed, did you realize
that something you did is only saving out the 'modified' values? I didn't see
it mentioned in the logs.)
# bd1.py
# Bound to BO example #1
class myClass(object):
def _getMyProp1(self):
return self._myProp1
def _setMyProp1(self, val):
self._myProp1=val
MyProp1 = property(_getMyProp1, _setMyProp1, None, "My Prop #1")
def _getMyProp2(self):
return self._myProp2
def _setMyProp2(self, val):
self._myProp2=val
MyProp2 = property(_getMyProp2, _setMyProp2, None, "My Prop #2")
def __init__(self):
self.MyProp1 = 'a'
self.MyProp2 = 'b'
def swap(self):
self.MyProp1, self.MyProp2 = self.MyProp2, self.MyProp1
def test(self):
print self.MyProp1, self.MyProp2
self.swap()
print self.MyProp1, self.MyProp2
myObj=myClass()
myObj.test()
import dabo
app = dabo.dApp()
app.MainFormClass = 'bd1.cdxml'
app.start()
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<dForm Name="dForm" Caption="Bind to BO Demo" Top="273" Height="118"
Width="295"
designerClass="DesForm" UseSizers="True" Left="61">
<dSizer SlotCount="3" designerClass="LayoutSizer"
Orientation="Horizontal">
<dTextBox sizerInfo="{'BorderSides': ['All'], 'Proportion': 0,
'HAlign':
'Left', 'VAlign': 'Top', 'Border': 0, 'Expand': True}" Height="41"
designerClass="controlMix" DataSource="myObj" RegID="MyProp1"
DataField="MyProp1"></dTextBox>
<dButton RegID="swap" Caption="Swap" sizerInfo="{'BorderSides':
['All'],
'Proportion': 0, 'HAlign': 'Center', 'VAlign': 'Middle', 'Border': 0, 'Expand':
False}" designerClass="controlMix"></dButton>
<dTextBox sizerInfo="{'BorderSides': ['All'], 'Proportion': 0,
'HAlign':
'Left', 'VAlign': 'Top', 'Border': 0, 'Expand': True}" Name="dTextBox1"
Height="41" designerClass="controlMix" DataSource="myObj" RegID="MyProp2"
DataField="MyProp2"></dTextBox>
</dSizer>
</dForm>
_______________________________________________
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/dabo-users/[EMAIL PROTECTED]