tabpanel.addpanel("text") not working

This might be a senior moment …

Trying to add a new tabpanel via

TabPanel1.AddPanel("text")

But get “Too many arguments, got1, expected 0”.

Weird, though I would recommend not even trying. For the best user experience you should not be adding or removing tabs because that hides information from the user and inhibits exploration.

You may need to file a bug report for this!

The code is not working in Xojo2019r3.1, don’t know if it worked on a previous version (r2 or r3).

Please file a bug report.

If you need a workaround:

TabPanel1.AddPanel TabPanel1.CaptionAt(TabPanel1.LastAddedPanelIndex) = "text"

Edit: feedback://showreport?report_id=59583

59591 - tabpanel1.addtab(“text”) not compiling

Thanks.

the API version, append(name as text), works fine here in 2019r1.1 and 2019r3.1

these small glitches in API 2 methods are why I suggested they have a 100% test case coverage as moving to something that we’re not sure of is actually working as a replacement means a lot of trial an then bug hunting to figure out if its out code or theirs

is such a test bed a shit pile of work ? you bet
would it increase confidence that moving to api 2 and updating our code accordingly would NOT suddenly result in broken code ?
100%

all this said addtab does also work here in 2019r3.1

Normal - how do you get to find out about .append and .addTab as neither seem to be present in the online manuals?

autocomplete showed them for me in 219r1.1 and in 2019r3.1
and they are in the local references in both editions

OK - I can see them in autocomplete - what is a local reference?

When you click Help in Xojo and the preference is set to built-in documentation.

AddTab is the correct method to use. I’ve updated the online docs.

the one built in to every release of Xojo since … 2013 0r 14 ?
Preferences > General > When Seeking Help > Use Built-in documentation
This way old versions have the old api’s etc

Tks.

Can you update https://documentation.xojo.com/api/deprecated/tabpanel.html.Append to point to TabPanel.AddTab and not to TabPanel.AddPanel?

Following the idea of .AddTab, I think you should change .AddPanelAt to .AddTabAt (with optional Name field) and .RemovePanelAt to .RemoveTabAt

BTW, .Remove works but .RemovePanelAt doesn’t feedback://showreport?report_id=59592

Edit: TabPanel.AddTabAt(Index as Integer, name as String) should be instead of .AddPanelAt

Thank you Paul for updating TabPanel.Append. A question what will happen to TabPanel.AddPanel I think is not needed because it can only add a nameless Tab at the end.

TabPanel.Insert can be used like this:

TabPanel1.Insert(1, "new")

but TabPanel.AddPanelAt only allow 1 argument (Integer), so it create nameless Tabs

For consistency if the correct method is AddTab, I think the other 2 should be AddTabAt and RemoveTabAt, what do you think? feedback://showreport?report_id=59595

TabPanel inherits from PagePanel, which is where AddPanel exists. It is needed to add panels to the PagePanel.

Thank you Paul.

One question, can’t you make the AddPanel behave like AddTab just for TabPanel? I mean, just .AddPanel will add a nameless Panel at the end of the TabPanel, but using .AddPanel(“name”) will create a Panel with name as Tab?

The same for TabPanel.AddPanelAt, can’t you make it work like TabPanel.AddPanelAt(1, “name”)

I don’t think .AddTab is needed just to handle the name that AddPanel is missing and creates inconsistency with PagePanel.

I’m looking at your case now. Looks like we can clean up some things here.