[Gambas-user] Still jacking with tabstrips properties and adding tabs
Ron Onstenk
ronstk at ...239...
Thu Aug 14 02:05:06 CEST 2008
On Wednesday 13 August 2008, M0E Lnx wrote:
> I tried that, and for some reason it doesnt work here
> In my head it always made sense like that, keeps giving me an new tab
> but sets the .text ("New Tab") property to the one before the last
>
> I still dont understand why it does that
>
>
>
> On Wed, Aug 13, 2008 at 10:33 AM, Ron Onstenk <ronstk at ...239...> wrote:
> > On Wednesday 13 August 2008, M0E Lnx wrote:
> >> Thanks... i found a way to fix this by declaring an additional integer
> >> variable and assigning it's value before the WITH statement.
> >>
> >> goes like this
> >>
> >> for i = 0 to array.count - 1
> >> idx = tabstrip1.count - 1
> >>
> >> with tabstrip1
> >> .count = .count + 1
> >> .index = idx
> >> .text = "New Tab"
> >> end with
> >>
> >>
>
Very, very strange.
Lets asume we have 4 tabs and want to add a 5'th
tabstrip1.count should be 4 now
idx = tabstrip1.count - 1 ' idx will be set to 3 here
with tabstrip1
.count = .count + 1 ' increase 4 to 5
.index = idx ' idx is 3
.text = "New Tab" ' is this on the 4'th tab instead the 5'th ?
end with
idx should be 3 here, and you do increase the .count for the 5'th tab
then the .index for it should be 4 (0 based).
Try to add the print instruction
idx = tabstrip1.count - 1 ' idx will be set to 3 here
with tabstrip1
.count = .count + 1 ' increase 4 to 5
print .count ' i'm currious what you see, should be 5
.index = idx ' idx is 3 but should be 4 (the new last tab index)
.text = "New Tab" ' is this on the 4' tab instead the new 5' ?
end with
If the print .count is wrong (not 5 but other) then the _WITH tabstrip1_
does something strange/wrong.
I do suggest to try without the beautifull _WITH_, just once for test
' with tabstrip1
tabstrip1.count = tabstrip1.count + 1 ' from 4 to 5
print tabstrip1.count
tabstrip1.index = tabstrip1.count - 1 ' 5 - 1 = 4
tabstrip1.text = "New Tab"
' end with
If this works then you may have found a bug in WITH for the handling the properties.
Ron 1st
More information about the User
mailing list