On Saturday 30 August 2008 06:17:54 am Sibylle Koczian wrote:
> Hello,
>
> I don't understand the API documentation of dPageFrame.appendPage: the
> parameters are pgCls, caption, imgKey. pgCls seems to be a reference to the
> _class_ of the page being added, right? How do I get a reference to the
> instance to add controls to the page?
>
> There is no dPageFrame demo which would show how to do it.
>
> Or should I always create a dPage subclass, complete with the controls i
> want my page to have? But even then, what if I wanted to add several
> instances of the same subclass?
>
> Or what did I miss here?
>
> Thank you
> Sibylle
I like how Ed explained the pageframe. But I think it might help if I explain
how I use the pageframe.
I like to create classes based on a dPanel (you have a panel anyway to get the
tab to work):
class AddressPanel(dabo.ui.dPanel):
Then in the method afterInit of my class I add my controls.
def afterInit(self):
self.Sizer = dabo.ui.dSizer("h")
vs = dabo.ui.dSizer("v")
#Create the Contact information block
gs = dabo.ui.dGridSizer(MaxCols=4,HGap=3, VGap=3
etc....
of course you add any additional methods as required for the class.
Next I create a class to hold my pageframes
class MainPanelFrames(dabo.ui.dPanel):
def afterInit(self):
self.Sizer = vs = dabo.ui.dSizer("v")
pageFrame = pgf = dabo.ui.dPageFrame(self)
pgf.RegID= "FormPG"
pgf.appendPage(pgCls=AddressPanel, caption="Information")
# don't forget to add to the sizer
vs.append(pgf, 0,"x") # proportion=0, layout=expand)
I give my self a RedID for the pageframe in case I need a way to call
something on the pages
And last I add the MainPanelFrames to the MainForm
self.Sizer.append1x(MainPanel(self))
What this does is allow me to segment my code and therefore it is very easy to
change code as required.
--
John Fabiani
_______________________________________________
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]