[Gambas-user] TextBox and CR

Ron ron at ...1740...
Wed Apr 21 17:10:38 CEST 2010


If I mis understood the issue please ignore me but...

I have seen occasions in my Gambas project where:

IF this AND that THEN

didn't always do what it was suppose to do.

I had to do:

IF this AND IF that THEN

Most of the times the first one worked ok, but not always...

Regards,
Ron_2nd.
>> the IF clause will jump out and deliver TRUE
>>     
>
> Don't think this applies to Gambas.  It's quite common in Java for
> example to use something like if (myvar != null &&
> myvar.equals(somestring)) as we know that java WILL jump out of the
> evaluation with FALSE as soon as it finds myvar is null (hence avoiding
> the dreaded NullPointerException).  You can get java to work in a
> non-short-circuited way by using & in place of && but I rarely see that
> in practice.
>
>  (only with OR - not with AND, XOR etc... of course) :-)
> Well, for AND... errrm see above ;-)
>
> Regards,
> Caveat
>
>   
>>     
> On Wed, 2010-04-21 at 08:44 +0200, Rolf-Werner Eilert wrote:
>   
>> Am 20.04.2010 19:30, schrieb Doriano Blengino:
>>     
>>> Rolf-Werner Eilert ha scritto:
>>>       
>>>> No, don't worry :-)
>>>>
>>>> So, this is my code now:
>>>>
>>>> PUBLIC SUB Suche_KeyPress()
>>>> DIM t$ AS String
>>>>
>>>>        IF Key.Code = Key.Return OR Key.Code = Key.Enter THEN
>>>>          t$ = Trim$(Suche.Text)
>>>>          IF t$<>   "" THEN
>>>>            SucheStarten(t$)
>>>>          END IF
>>>>        END IF
>>>>
>>>> END
>>>>
>>>> I introduced t$ (old BASIC manners, I know :-) ) to avoid calling trim
>>>> for several times, and I feel it's shorter and reads easier. Then I set
>>>> Key.Return first as it would be pressed more probably, and this routine
>>>> is called for each key.
>>>>
>>>> Later I realized that this is nonsense as it will check for Key.Enter
>>>> with every key typed other than Return ;-) anyway...
>>>>
>>>>         
>>> No... it will check for Key.Enter every key you press, be it Return or not!
>>>
>>> Just kidding, but it's true... :-)
>>>
>>> Regards,
>>> Doriano
>>>
>>>
>>>       
>> Oh - I thought when the first condition is fulfilled, the IF clause will 
>> jump out and deliver TRUE (only with OR - not with AND, XOR etc... of 
>> course) :-)
>>
>> Regards
>>
>> Rolf
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>     
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> 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