Dynamic Tab Pages in Perspective

Hi,

I have this empty tabContainer with one tab page. There are some buttons on this tabpage that allows the user to add a new tab page. I’m using the following code to do this:

        tabs = self.parent.parent.parent.getChild("TabContainer").props.tabs
	tabs.append("New Tab " + str(len(tabs)) )
	self.parent.parent.parent.getChild("TabContainer").props.tabs = tabs
	self.parent.parent.parent.getChild("TabContainer").props.currentTabIndex = len(tabs) - 1

This all works fine, but now I would like to add some content to this new TAB. I would like to add an embedded view that is 100% sized to the tabpage. What is the best way to do this?
Is it possible to create dynamically an Embedded view and change the tabindex of this component?

Thank you,
Thijs

The Tab Container is not intended to be modified at runtime, and so while there could conceivably be a really fancy way of scripting the addition of an Embedded View component into a Tab Container at runtime, it seems like this might not even be the solution you’re looking for.

Do you need to “tabbed” layout? Have you looked at the Embedding category of components? This seems like something a Flex Repeater or Accordion might be better suited for. Both allow for supplying a path to a view so that you don’t have to supply your own Embedded View component, and therefore they can expand their displayed view count at runtime. The Accordion would even allow for keeping the tabbed or categorized layout, albeit vertical instead of horizontal.

hello cmallenee

is there an example of this idea?

No.

1 Like