Adding Tabs with Dynamic Elements

I am working on a project in which the user interface has many dynamic components where the controls are added as needed.

One group of these controls is being added into a tab panel. The issue is, when it is detected that there is no more space on the panel, it makes a new tab (I have that part working), but how do I make the new control be placed on the new tab? It seems that I can only get it to overlap the first element on the original tab.

Hopefully I am being clear enough and not too vague or confusing.

Would it be an option to have a canvas on the form in which you can throw a containercontrol dynamic.
It’s easy to make a scrolling form this way with a scrollbar etc.

[quote=212440:@Meade Lewis]I am working on a project in which the user interface has many dynamic components where the controls are added as needed.

One group of these controls is being added into a tab panel. The issue is, when it is detected that there is no more space on the panel, it makes a new tab (I have that part working), but how do I make the new control be placed on the new tab? It seems that I can only get it to overlap the first element on the original tab.

Hopefully I am being clear enough and not too vague or confusing.[/quote]

You can specify the Tab in EmbedWithinPanel
http://documentation.xojo.com/index.php/ContainerControl.EmbedWithinPanel

How are you adding the controls? If a Control Set, you should also set the PanelIndex property for each new control.

I am doing the addition of the controls through a control set. My code looks like the following:

if (((18*filecount)+FileRadioButton(0).top) + FileRadioButton(0).height) >= (FilesTabPanel.top + FilesTabPanel.Height) then FilesTabPanel.Insert(FilesTabPanel.Panelcount) FilesTabPanel.caption(FilesTabPanel.Panelcount-1) = str(FilesTabPanel.Panelcount) FirstonPage = true FilesTabPanel.Panelindex = FilesTabPanel.Panelcount end dim c as new FileRadioButton

After this I state the location of the new radio button (c) as follows:

if FirstonPage = true then c.Top = 58 FirstonPage = False else c.top = (18*FileCount)+FileRadioButton(0).top end

Why is it overlapping rather than going to the second tab?

Thanks!

Looks like you need this somewhere:

c.PanelIndex = FilesTabPanel.PanelCount

You want to specify the PanelIndex for the newly added control.

[quote=212465:@Paul Lefebvre]Looks like you need this somewhere:

c.PanelIndex = FilesTabPanel.PanelCount

You want to specify the PanelIndex for the newly added control.[/quote]

The trick was that I had to do c.panelindex for the individual control, I was attempting to preform this with the tabpanel itself which got me nowhere.

As for your code, I had to edit it slightly:

c.PanelIndex = FilesTabPanel.PanelCount-1

Thank you so much!!!