I posted this to the Getting Started list, but it may be more
appropriate here... sorry for the cross-posting.
I have a ComboBox that creates new tabs as items are selected...
But I want to limit the number of open tabs to 5 or so. So, I've
written the code to Remove the first tab when a 6th one is opened one
is opened.
I'm also creating a new ContainerControl and embedding it on the new
tab.
What I'm finding is that it's works the first time, but the second
time the Remove method is run, it crashes the whole app.
Here's the code (change event snippet) :
// remove the first tab
if CustomerTabPanel.PanelCount = 5 then
CustomerTabPanel.Remove(0)
end if
// create the new tab
customerName = rs.Field("last_name").StringValue + ", " +
rs.Field("first_name").StringValue
CustomerTabPanel.Append(customerName)
// add the container control to the new tab
customerCard.EmbedWithinPanel(CustomerTabPanel,
CustomerTabPanel.PanelCount - 1)
// switch to the new tab
CustomerTabPanel.Value = CustomerTabPanel.PanelCount - 1
Secondly, I've added a button to close the current tab, and the same
thing happens. Except it seems to be random as to how many times it
will work before crashing. Sometimes it crashes on the first press,
sometimes on the second and most rarely on the third. It never gets
to more than 3 before crashing.
The code:
CustomerTabPanel.Remove(CustomerTabPanel.Value)
I can't find any known bugs dealing with this. The only thing I have
come up with is that maybe it doesn't like destroying the tabs with
the whole ContainerControl, and all of it's controls.
Please let me know if you know anything about this problem.
Best Regards
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>