Add/Remove tabs dynamically with its one controls

Hi,

I need to add/remove tabs in tabPanel dynamically.
From other comments, I realized that I can make a containerControl and put the required controls on it.

In my case, user would generate several requests and each one will get its own Textarea and labels.
If I make only one containerControl, how can I keep the different TextArea control?

I noticed that I can add(make) many ContainerControl in the PagePanel. Good.
However, I’m still not sure how I can keep the different Textarea in each containerControl.
I need to get 1 Textarea per 1 ContainerControl, and the name of Textarea should be different.
Is there any want to change the name of Textarea control on the fly?

CompResPagePanel.Append
CompResPagePanel.Value=1

dim objMyContainer as CompResultAreaContainer
objMyContainer = new CompResultAreaContainer

objMyContainer.EmbedWithinPanel(CompResPagePanel,1)

objMyContainer.Left = 31
objMyContainer.Top = 452
objMyContainer.Width = 1589
objMyContainer.Height = 306

No, you cannot change the name of the textarea on the fly. They are distinguishable only by the fact they are in different containers. You can distinguish the container by its PanelIndex property.

You could make a subclass of textarea and give it a property that you could use directly.

Can you explain about using the sub-classed textarea property?
I need to distinguish those Textarea in DataAvailable event. I got the answer from here that I can distinguish sub-classed Shell by creating a property like below.

Dim shell_COMPMON As getRepShell_COMPMON
shell_COMPMON = New getRepShell_COMPMON
mgetRepShell_COMPMON.Append(shell_COMPMON)
shell_COMPMON.JOBID = JOBID_value…

Hi,

Error says that CompResultAreaContainer.CompResultAreaContainer has no member named “PanelIndex”
If I use TabPanelIndex it works, but document says that it is a deprecated parameter.

dim objMyContainer as CompResultAreaContainer
objMyContainer = new CompResultAreaContainer

objMyContainer.EmbedWithinPanel(CompResPagePanel,i)
   
objMyContainer.Left = 31
objMyContainer.Top = 452
objMyContainer.Width = 1589
objMyContainer.Height = 306
  
objMyContainer.CurrentcompStatusArea.CompTextAreaIndex = objMyContainer.[b]PanelIndex[/b]
objMyContainer.CurrentcompStatusArea.Text = str(objMyContainer.[b]PanelIndex[/b])

Can you let me know what I did wrongly?

You can distinguish controls by their handle. See http://documentation.xojo.com/index.php/Control.Handle

Each handle is unique, so you can use that without need for an additional property.

[quote=188934:@changwon lee]objMyContainer.CurrentcompStatusArea.CompTextAreaIndex = objMyContainer.PanelIndex
objMyContainer.CurrentcompStatusArea.Text = str(objMyContainer.PanelIndex)
[/quote]

PanelIndex is not a property of TabPanel, but of the control that is placed on it. For instance, if you have a TextArea on a TabPanel and want to know on which page it is, use TextArea1.PanelIndex.

If you want to know which is the current page, use TabPanel.Value

See http://documentation.xojo.com/index.php/PagePanel.Value

It is important you make the effort to read and try to understand the language reference pages. They give you example code, and tell you precisely what each property does. For instance, for Value at the page I linked to :
The number of the currently selected page. The first page is number zero.