I wrote quite a big app for my personal accounting needs. I use 2 different list boxes. One of them works fine.
The other one does not accept German Umlaute like ",… or any special character. When I press a special Character I get a system beep (not programmed by me) and the character is not displayed. The “text change event” is not fired even I return False in the Cell key down event. The system beep is produced when ending the Cell key down event routine with return False.
What can I do to find the problem? If somebody can help me -> That would be …
I use Xojo r2017R2.1. I made test’s with newer Xojo releases -> no difference. I have an old version compiled with
Imagine, I use the Cell of the Listbox as an edit fiel to enter Text. Everything works fine except the acceptance of special Characters. As soo as I press the special Character I get the beep. All other Characters are accepted and “displayed” correctly. I do not treat every character it self. Only when I press return I recover the text from the Listbox Cell.
Emile, I guess Claude just wanted to limit the text to 40 characters and be able to type German Umlaute like “,…”, and with LEN check is enough for this.
[quote]I use 2 different list boxes. One of them works fine.
The other one does not accept German Umlaute like ",… or any special character.[/quote]
then:
[quote]Finally I have found the cause for the problem! But I still don’t have a workaround.
The problem ist the following Programm line: ActiveCell.Mask = “&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&”[/quote]
After I read that, at least for me, the problem is that no special characters can be entered with that mask and need to limit to 40 characters.
I can’t find a mask character that will work for this situation, so I guess the OP removed the mask (to let special characters work) but use LEN to limit the input to 40 characters or less.
LEN, did not fix the mask problem. As I understand LEN only helped for the 40 character max input and I guess OP removed the mask.
[quote]& - Character or space placeholder. It accepts one character.
Valid values are the ASCII characters 32-126 and the non-ASCII characters 128-255. For example, the mask “&&-99999” accepts “li20520” and returns “li-20520”.[/quote]
I wonder if is character 132, is 148, then why is not possible to enter those with mask &
I guess that’s the problem. I found a list of extended ascii characters that say that is 132, is 148, but I can’t make Xojo display that on mac. Then I found a different table ascii extended character set for mac.
When I type or into a TextField or string it is coded as UTF8 and that’s two bytes (as you said).
Extended ASCII is meaningless unless you specify which encoding or code table you use as different computer systems or geographic regions use it for different characters.
This simply does not exists even if you are able to localize some tables of characters with that name in the internet.
ASCII is 0-127.
Now, even with the use of Len, a bug still exists. Why ?
Because to get a ã you have to type two characters: the ~and the a. So when you have 39 characters and you want to type one with an accent, you will not be able to do that (testings have to be done to confirm that).
Alberto: thank you for your analyze. Now, I understand.
I think Emile is trying to say that having code on KeyDown will mess up the LEN count. Len will be 40 after you press Option-n, and will stay on 40 when you press a after that.
If you have this code on KeyDown:
If Len(Me.Text) = 40 Then Return True
you will end with something like this:
you can’t finish your input of .
Edit: one way to deal with this is using TextChange instead and something like:
If Len(TextField1.Text) > 40 Then
TextField1.Text = TextField1.Text.Left(40)
End if