Hi Everyone
I am stuck I have read up on how to remove a tab from a Tab Panel (I need to remove it when I add products but it shows when I edit them as it shows the products history)
But when I use the TabPanel1.remove(4) I get a Bad Index Error
I have 5 tabs in my Tab Panel
I am using TabPanel1.index = 0 to set it to the first tab (Product Information)
I have the following tabs
0 - Product Information
1 - Stock Locations
2 - Supplier & Pricing
3 - Web Settings
4 - Product History
Depending on the setting I need to always hide tab 4 when I am in Add mode but when in edit I need to hide Tab 3 if the system is set Not to sync with Opencart
can someone help me as I have no idea how to correct this.
[Solved] TabPanel1 bad index
-
- Posts: 377
- Joined: Wednesday 2nd December 2020 12:11am
- Location: Northampton, England
- Contact:
[Solved] TabPanel1 bad index
Last edited by AndyGable on Monday 26th February 2024 4:50am, edited 1 time in total.
- BruceSteers
- Posts: 1828
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: TabPanel1 bad index
did you try the .Visible property? probably easier than removing/adding
https://gambaswiki.org/wiki/comp/gb.for ... lcontainer
hmm probably just
https://gambaswiki.org/wiki/comp/gb.for ... lcontainer
' tab 3 hides if not in edit, or if in edit it hides if no opencart or shows if opencart
TabPabel1[3].Visible = If(bIsInEditMode, If(bCanUseOpencart, True, False), False)
TabPabel1[4].Visible = Not bIsInAddMode
hmm probably just
TabPabel1[3].Visible = bIsInEditMode And bCanUseOpencart
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: TabPanel1 bad index
what he said.
But also..
you cannot remove a tab panel if it has stuff inside it.
b
But also..
you cannot remove a tab panel if it has stuff inside it.
b
-
- Posts: 377
- Joined: Wednesday 2nd December 2020 12:11am
- Location: Northampton, England
- Contact:
Re: TabPanel1 bad index
Thanks BruceSteers I must be having a very BAD day today if I could not remember something that simple.BruceSteers wrote: ↑Monday 26th February 2024 12:33am did you try the .Visible property? probably easier than removing/adding
https://gambaswiki.org/wiki/comp/gb.for ... lcontainer
' tab 3 hides if not in edit, or if in edit it hides if no opencart or shows if opencart TabPabel1[3].Visible = If(bIsInEditMode, If(bCanUseOpencart, True, False), False) TabPabel1[4].Visible = Not bIsInAddMode
hmm probably just
TabPabel1[3].Visible = bIsInEditMode And bCanUseOpencart
- BruceSteers
- Posts: 1828
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: [Solved] TabPanel1 bad index
No worries, It's easy to miss all an object can do on the wiki.
Never underestimate the importance of these 2 little links on wiki pages... They will take you to the pages that are relevant to..
Creating new
myVar = New Object
https://gambaswiki.org/wiki/comp/gb.form/tabpanel/_new
Or using as an Array[]
https://gambaswiki.org/wiki/comp/gb.form/tabpanel/_get
the _get link has the link for all the _tabpanelcontainer properties
https://gambaswiki.org/wiki/comp/gb.for ... lcontainer
Never underestimate the importance of these 2 little links on wiki pages... They will take you to the pages that are relevant to..
Creating new
myVar = New Object
https://gambaswiki.org/wiki/comp/gb.form/tabpanel/_new
Or using as an Array[]
https://gambaswiki.org/wiki/comp/gb.form/tabpanel/_get
the _get link has the link for all the _tabpanelcontainer properties
https://gambaswiki.org/wiki/comp/gb.for ... lcontainer
If at first you don't succeed , try doing something differently.
BruceS
BruceS