Hi,
I have been through a ton of troubleshooting and it seems my conclusion is accurate, despite some people saying it should work. Nobody else has tested it and produced desired results, so I am submitting this. If I'm wrong, by all means please prove so and show me what I need to do.
A TabPanel control - unlike a TabStrip control, cannot have the tab count set dynamically in code. It only works if you set it in the IDE during design phase.
I have tested and compared the two control types - TabStrip and TabPanel, and while the TabStrip responds exactly as it should - ie: MyTabStrip.Count = 5 during the form load, properly changes the tab count to 5. However, it fails to do so with the same code used on a TabPanel.
That's my report. Please do feel free to corroborate or refute by testing.
BUG: TabPanel
- BruceSteers
- Posts: 1748
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: BUG: TabPanel
I just tried this exact code with a TabPanel that does not have Count set in the IDE...AndrewZabar wrote: I have been through a ton of troubleshooting and it seems my conclusion is accurate, despite some people saying it should work. Nobody else has tested it and produced desired results, so I am submitting this. If I'm wrong, by all means please prove so and show me what I need to do.
Public Sub Form_Open()
TabPanel1.Count = 4
TabPanel1[0].Text = "tb 0"
TabPanel1[1].Text = "tb 1"
TabPanel1[2].Text = "tb 2"
TabPanel1[3].Text = "tb 3"
End
Works completely as expected.
Post your test program or the code so we can see all that you are doing,
Rather than saying nobody is doing enough with testing it for you!
Many of my own programs use TabPanel and have the Count set by code.
My Script Editor and My Terminal program (and others) have dynamically created/destroyed tabs.
I had zero need to try the above code in a test in a standalone application just for you, but i did.
It works as it should.
We completely understand what you are saying but we do not get the error.
So you must be doing something different.
Open the test project that fails and select "Project/Make source archive" in the menus.
post the archive and we will see what the issue is for you.
If at first you don't succeed , try doing something differently.
BruceS
BruceS
-
- Posts: 27
- Joined: Monday 19th June 2023 1:51pm
Re: BUG: TabPanel
Okay but, see you set the text property.
My code simply used the .Count = 4 for example. The documentation on .Count property says "returns or sets" and I think the problem is in the TabPanel, setting the count via this property does not work. Please see if you can do this without the .Text lines, and just see if the tabs propagate based solely on the .Count.
Try making a TabPanel and in the form open, just TabPanel1.Count = 4 and see if it works. It doesn't.
It DOES work with a TabStrip, though.
Maybe it was just never implemented? In which case the IDE smart sense that pops up with the definition, should not indicate sets, only returns.
My code simply used the .Count = 4 for example. The documentation on .Count property says "returns or sets" and I think the problem is in the TabPanel, setting the count via this property does not work. Please see if you can do this without the .Text lines, and just see if the tabs propagate based solely on the .Count.
Try making a TabPanel and in the form open, just TabPanel1.Count = 4 and see if it works. It doesn't.
It DOES work with a TabStrip, though.
Maybe it was just never implemented? In which case the IDE smart sense that pops up with the definition, should not indicate sets, only returns.
Last edited by AndrewZabar on Tuesday 14th May 2024 2:08pm, edited 1 time in total.
-
- Posts: 27
- Joined: Monday 19th June 2023 1:51pm
Re: BUG: TabPanel
OH good grief! So they were there, but just invisible.PJBlack wrote: ↑Tuesday 14th May 2024 1:52pm https://gambaswiki.org/edit/comp/gb.form/tabpanel/count
read ... try to understand ...
Hey when I read the basic documentation of the TabPanel, it said it inherited from TabStrip and then has enhancements. Awesome sauce, except with a tabStrip the tabs are auto-named.
I apologize! I think though, that in the interest of consistency, the tabPanel should auto-name just as tabStrip does. Just my humble opinion. It just never occurred to me that it would act in a way that is like tabStrip except minus a certain behavior. So that explains that.
I REALLY appreciate your help with this.
Re: BUG: TabPanel
afaik bruce shows you the way to get this behaviour ...
-
- Posts: 27
- Joined: Monday 19th June 2023 1:51pm
Re: BUG: TabPanel
Sweet, I'll look into it. I'm fine naming them it's just I didn't assume I had to lol.
Anyway, thank you again for your patience with me
![Smile :)](./images/smilies/icon_e_smile.gif)
I wish the VB6/Gambas approach to development were more popular. I learned VB6 way back in the late '90s-ish, and I was able to learn it so rapidly.
Over the years I fiddled with other stuff but it's not easy for me to pickup other languages. I am probably going to make an attempt at Python but other than that, Gambas rocks!
Re: BUG: TabPanel
forget python ...
-
- Posts: 27
- Joined: Monday 19th June 2023 1:51pm
Re: BUG: TabPanel
Seriously?
I read just yesterday that it is the easiest language that's widely used for developing Linux applications.
What language would you recommend (if any) for a non-pro coder? I'm really an amateur but I've made quite a lot of applications over the years, some quite sophisticated. But they were all in VB6. I even made a custom ActiveX control years ago for a management software suite made in Foxpro.
That being said, I'm rusty, and also older, which means it will be harder to learn something new. If there is simply nothing appropriate, that's ok to say, too.
Re: BUG: TabPanel
That's a bit like saying that Swahili is easier to learn than Inuit. (Said the native from ...) Until an Irishman of Indian parentage living in Beruska proves to me that python is easy, I'll stick with Basic. I didn't learn it as a first language, that was Fortran, but had to come to terms with something called PDP Basic2+ in my first job as I really hated coding assembler for a PDP4.
Having said that, the language that I most enjoyed using was PL1. Today I would have no idea of how to code "Hello World" in PL1. Gambas gave me back my joy of coding.
So do what you like and enjoy it. That's all.
Having said that, the language that I most enjoyed using was PL1. Today I would have no idea of how to code "Hello World" in PL1. Gambas gave me back my joy of coding.
So do what you like and enjoy it. That's all.