[Gambas-user] static const?

Fabián Flores Vadell fabianfloresvadell at ...626...
Wed Apr 14 04:31:50 CEST 2010


2010/4/13 Jussi Lahtinen <jussi.lahtinen at ...626...>:
>> Just in case:
>>
>> REPEAT
>>     b = TabStrip3.Count ' In fact, this does nothing usefull
>>     INC a
>> UNTIL a < TabStrip3.Count OR TabStrip3[a].Caption = IdCaption
>
>  This doesn't make same functionality.

That is why I did not want to follow the example anymore.

This function never had has any functionality, due to their errors.
Neither, your version of the function, because it returns
TabStrip3.Count which is the amount of tabs containing the control, ie
always return the same value.

>  Because if ldCaption doesn't match to any of tabstrip captions,
>  function will still answer TabStrip3.Count instead of zero.
>  In short, you cannot remove IF THEN construct.

Put it out of loop.


The correct code:
------------------------

PRIVATE FUNCTION ScanTab(IdCaption AS String) AS Byte
DIM a AS Byte = 0

  WHILE (a < TabStrip1.Count - 1) AND (TabStrip1[a].Text <> IdCaption)
    INC a
  WEND

  RETURN IF(TabStrip1[a].Caption = IdCaption, a, -1)
END

>  I think I have done enough errors for this day (I'm going to sleep).

Sweet dreams (my childs are going to sleep right now, too).


-- 
Fabián Flores Vadell
www.speedbooksargentina.blogspot.com




More information about the User mailing list