Re: Text entry limitation

Jean-Luc Arnaud <jean-luc-E/[email protected]>
Newsgroups gmane.comp.lang.realbasic.user
Organization Centre Direct du Multimédia
Message-ID <[email protected]>
Hi Arnaud

> I use Select case Asc(Key) instead of comparing against Chr...I have 
> seen cases where the equality wasnÂ’t true
Thanks for this information, I didn't know that.

> As I understand, youÂ’re trying to only accept roman characters, right?
Right !

> Why do you handle the chr(9) like this? 
Nothing to do with filtering characters. I just want to be sure that Tab 
will give focus to the specified field.

> (and donÂ’t forger if the user is actually typing Shift-Tab to move the 
> focus to the previous field!)
And, of course, I forgot it! Thanks for pointing that. Actually, the 
case Is>=Chr(32) lets the Shift-Tab works properly.

> Also, Is>=Chr(32) is redundant with Chr(13) and chr(3) returning 
> false. IÂ’m just saying that to improve the piece of code above.
I don't think so. It's the part of the filter that deal with any other 
character except those previously filtered. It could be replaced par the 
'Else' part of the Select Case test. This lets the TextField not 
accepting any character >=Chr(32), but working as usual for the others, 
like arrows, Shift-Tab, ...


Jean-Luc Arnaud

Le 18/08/2017 à 18:28, Marnaud a écrit :

> Le 18 août 2017 à 18:17 du soir, Jean-Luc Arnaud 
> <jean-luc-E/[email protected] <mailto:jean-luc-E/[email protected]>> a écrit:
>>
>> I finally coded that in the KeyDown event of a TextField control:
>>
>> Select Case Key
>>
>> Case "I","V","X","L","C","D","M", Chr(13), Chr(3), Chr(127)
>>   Return False
>>
>> Case Chr(9)
>>   Décimal_TextField.SetFocus
>>   Return True
>>
>> Case Is>=Chr(32)
>>   Return True
>>
>> End Select
>>
>> This matches exactly my need (except for Drag/Drop and Paste).
>>
>
> I usually do something like that. The notable difference being I use 
> Select case Asc(Key) instead of comparing against Chr (this is the 
> other way around, but I do like that because the language reference 
> state that Chr returns character as ASCII values and I have seen cases 
> where the equality wasnÂ’t true).
>
> As I understand, youÂ’re trying to only accept roman characters, right?
>
> Why do you handle the chr(9) like this? The tab key should just work 
> if you return false (and donÂ’t forger if the user is actually typing 
> Shift-Tab to move the focus to the previous field!)
>
> Also, Is>=Chr(32) is redundant with Chr(13) and chr(3) returning 
> false. IÂ’m just saying that to improve the piece of code above.
>
> Regards
>
> To unsubscribe, email us here. <mailto:[email protected]>
>




To unsubscribe, email [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.