Dynamically add a tabpanel and use the
I want to add an htmlviewer for each added tabpanel.
May I suggest you add the HTMLViewer to a DesktopContainer then embed this Container on the newly added TabPanel.
Also keep an Array() of the DesktopContainers so you are able to remove them from the array when you remove a TabPanel ie PanelIndex = 0 is myHTMLViewerContainer(0).
var S(3) as String
s(0) = “htt://naver.com”
s(1) = “http://google.com”
s(2) = “http://daum.net”
for i as Integer = 0 to 3
'TabPanel1.TabIndex = i
'TabPanel1.RemovePanelAt(i)
TabPanel1.AddPanel(s(i))
'TabPanel1.PanelIndex = i
htmlW(i) = new Container1
htmlW(i).EmbedWithin(TabPanel1.Window, TabPanel1.Left, TabPanel1.Top+30, TabPanel1.Width, TabPanel1.Height-10)
htmlW(i).HTMLViewer1.LoadURL(s(0))
next
I wrote this code and it doesn’t seem to be working.
This makes it clearer that you’ve commented some stuff out.
var S(3) as String
s(0) = "htt://naver.com"
s(1) = "http://google.com"
s(2) = "http://daum.net"
for i as Integer = 0 to 3
'TabPanel1.TabIndex = i
'TabPanel1.RemovePanelAt(i)
TabPanel1.AddPanel(s(i))
'TabPanel1.PanelIndex = i
htmlW(i) = new Container1
htmlW(i).EmbedWithin(TabPanel1.Window, TabPanel1.Left, TabPanel1.Top+30, TabPanel1.Width, TabPanel1.Height-10)
htmlW(i).HTMLViewer1.LoadURL(s(0))
next
.
Did you mean to put s(i)
rather than s(0)
?
Yes, you want to create multiple tabpanels, each with an htmlviewer, and have them be different websites.
dim S(3) as String
s(0) = “htt://naver.com”
s(1) = “http://google.com”
s(2) = “http://daum.net”
for i as Integer = 0 to 3
'TabPanel1.TabIndex = i
'TabPanel1.RemovePanelAt(i)
TabPanel1.Insert(i,s(i))
TabPanel1.PanelIndex = i
TabPanel1.TabPanelIndex = i
Con(i) = new ContainerControl1
con(i).EmbedWithin(TabPanel1, TabPanel1.Lefti, TabPanel1.Top+30i, TabPanel1.Width, TabPanel1.Height-10)
con(i).TextArea1.Text = s(i)
next
dim S(3) as String
s(0) = “htt://naver.com”
s(1) = “http://google.com”
s(2) = “http://daum.net”
for i as Integer = 0 to 3
'TabPanel1.TabIndex = i
'TabPanel1.RemovePanelAt(i)
TabPanel1.Insert(i,s(i))
TabPanel1.PanelIndex = i
TabPanel1.TabPanelIndex = i
Con(i) = new ContainerControl1
con(i).EmbedWithin(TabPanel1, TabPanel1.Left*i, TabPanel1.Top+30*i, TabPanel1.Width, TabPanel1.Height-10)
con(i).TextArea1.Text = s(i)
next
To get the above, select your code and click in the
icon.
Nicer and as Tim wrote, we can see you commented some lines…
I was able to succeed by writing the following code
Thank you all for your answers.
var S(3) as String
s(0) = “http://naver.com”
s(1) = “http://google.com”
s(2) = “http://daum.net”
for i as Integer = 0 to 3
'TabPanel1.TabIndex = i
'TabPanel1.RemovePanelAt(i)
TabPanel1.AddPanel(s(i))
TabPanel1.PanelIndex = i
htmlW(i) = new Container1
TabPanel1.SelectedPanelIndex = i
htmlW(i).EmbedWithinPanel(TabPanel1,i)
htmlW(i).HTMLViewer1.LoadURL(s(i))
htmlW(i).Left = TabPanel1.Left
htmlW(i).Top = TabPanel1.Top+30
htmlW(i).Width = TabPanel1.Width
htmlW(i).Height = TabPanel1.Height
'htmlW(i).HTMLViewer1.Refresh
next