On Feb 4, 2008, at 1:15 PM, bsnipes wrote:
> class PLine(dabo.ui.dPanel):
> def afterInit(self):
> self.Sizer = vs = dabo.ui.dSizer("v")
> vs.append(dabo.ui.dButton(self))
> vs.append(dabo.ui.dButton(self))
>
> class Notebook(dabo.ui.dPageFrame):
> def afterInit(self):
> self.PageCount = 13
> pg0 = self.Pages[0]
> pg0.Caption = "General"
> pg1 = self.Pages[1]
> pg1.Caption = "Line 1"
> pg1line = PLine(self)
> pg1.addObject(pg1line)
>
> I get a 'PLine object is not callable'. What is the correct way of
> adding
> controls?
You're instantiating an object from the PLine class, and then passing
that to addObject(). You need to pass the class, not an instance.
This is one of the drawbacks of having more than one way to do
something. You can either create an obejct directly and pass its
parent to it, or you can call the parent's addObject() to create an
instance of the class. I strongly prefer the former, as I find it much
less confusing, but either should work as long as you remember the
correct way to use it. If you change the Notebook class to read:
class Notebook(dabo.ui.dPageFrame):
def afterInit(self):
self.PageCount = 13
pg0 = self.Pages[0]
pg0.Caption = "General"
pg1 = self.Pages[1]
pg1.Caption = "Line 1"
pg1line = PLine(pg1)
...it should work. Note that when you create the pg1line object, you
pass the desired parent to the constructor call; in this case, pg1.
-- Ed Leafe
_______________________________________________
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]