[Gambas-user] Still jacking with tabstrips properties and adding tabs

M0E Lnx m0e.lnx at ...626...
Thu Aug 14 14:59:07 CEST 2008


Here is the code snipplet that I have where the tabs get added to the
tabstrip (additional to the existing tabs)
http://pastebin.com/m15deb6a5
and this is the complete module (in case that doesn't make sense)
http://vinstall-ng.googlecode.com/svn/branches/iVL/MdlLiloOsList.module

The method I have now works, but I still dont understand why in the
WITH statement if I increate the .count and try to set the index to
.count -1 doesn't work..

If a tabstrip has 5 tabs, the last index on there will be 4
do If I add one more, the count will increase to 6 and the total index
will increase to 5
I should be able to do .Count - 1 (should always be total tabs - 1).



On Wed, Aug 13, 2008 at 7:05 PM, Ron Onstenk <ronstk at ...239...> wrote:
> 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
>
>
> -------------------------------------------------------------------------
> 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 at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list