On Wednesday 29 July 2009 04:05:56 pm Miguel Lopes wrote:
> I'm wondering about how to add or remove panels from a form at runtime.
> I see two approaches:
>
> 1. Creating a new panel and replacing an existing one (destroying the old
> one). Meaning the new panel would take whatever sizer slot the original
> panel was occupying.
>
> I haven't thought about how this could be achieved. Any clues?
>
> 2. Creating both panels up-front with one of them hidden (with the
> Visible property set to False) .
> Then it would be a matter of toggling the visibility of panels to hide
> or show them.
>
> I wonder if you have a better approach, or if there is something
> missing in the following approach?
>
> # Two panel classes are previously defined
>
> class MainForm(dui.dFormMain):
>     def afterInitAll(self):
>         vs = self.Sizer = dui.dSizer('v')
>         btn = dui.dButton(self, Caption='Click me')
>         vs.append(Panel1(self))
>         vs.append(Panel2(self))
>         vs.append(btn)
>         self.layout()
>
>         btn.bindEvent(dabo.dEvents.Hit, self.panelToggle)
>
>     def panelToggle(self, evt):
>         panel1 = self.getObjectByRegID("panel1")
>         panel2 = self.getObjectByRegID("panel2")
>
>         panel1.Visible = not panel1.Visible
>         panel2.Visible = not panel2.Visible
>
>         self.layout()
>
> Txs for comments,
> Miguel

http://dabodev.com/wiki/HowToOverlayControls
 
the above is a link to the wiki.  I believe that code at the link will work 
with any dabo object including panels.




_______________________________________________
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]

Reply via email to