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 <[EMAIL PROTECTED]> 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 ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user