[Gambas-user] Keyboard function skipped?

Benoit Minisini gambas at ...1...
Thu Jun 3 18:12:05 CEST 2004


On Thursday 03 June 2004 13:11, Eilert wrote:
> Hi,
>
> The other day I was trying to implement something counting the text
> length in a text area. Very simple thing, just count the keystrokes from
> within TextArea1_KeyPress...
>
> However, I found that when I type too fast (I can type fast, about 250 -
> 280 chars/minute) the counter would skip some characters.
>
> So I decided to measure the length of the string within TextArea1
> instead, but isn't that strange?
>
> It is even more strange because there are two things done within my
> KeyPress function:
>
> 1. Sort out which key was pressed, only let characters pass through
>
> 2. Count
>
> The first one will run with every speed, no problem. It's just the
> second one which is skipped. There is a select case block figuring out
> the type of the key pressed and a case else at its end containing the
> counter. So every "case" works well blocking the special keys
> (movements, backspace etc.), but when I type a real character it might
> be ignored if too fast!
>
> Any explanation for that?
>
> Rolf
>
>

I don't know, but one KeyPress event can generate more than one character, as 
everything uses UTF-8 encoding and sometimes events are compressed by QT. 

I mean 'number of KeyPress events' <> 'number of typed characters" <> "length 
of typed string"

Maybe it is your problem ?

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list