[Gambas-user] WebTextArea vs. TextArea controlling events

Rolf-Werner Eilert rwe-sse at osnanet.de
Thu Sep 29 15:48:01 CEST 2022


Am 29.09.22 um 13:49 schrieb Benoit Minisini:
> Le 29/09/2022 à 12:43, Rolf-Werner Eilert a écrit :
>> Good morning everyone!
>>
>> Today I played a bit with WebTextArea and tried to implement some of 
>> the events controlling key, mouse etc. compared to TextArea. I have 
>> 3.17.2 on this system.
>>
>> Long time ago I wrote a little program controlling the keystrokes of 
>> TextArea_KeyPress. This reads somewhat like this:
>>
>>    If key.Control Then     'Strg+Taste übergehen:
>>      Stop Event
>>
>>    Else                    'einfache Tasten alle übergehen:
>>      Select Case key.Code
>>      Case key.BackSpace, key.BackTab, key.Delete
>>        Stop Event
>>      Case key.Down, key.Up, key.Left, key.Right
>>        Stop Event
>>      Case key.Home, key.End, key.PageDown, key.PageUp
>>        Stop Event
>>      End Select
>>
>>    End If
>>
>> I had also implemented my own linewrap to limit input to 70 characters 
>> a line. All this runs pretty well there.
>>
>> Now I wanted to know if there is a chance to implement this to a 
>> WebApp. So I used WebTextArea and inserted the code above (and 
>> somewhat more) from the old project to WebTextArea_KeyPress. But 
>> WebTextArea doesn't seem to catch the keystrokes or at least the code 
>> doesn't have any effect. Is there a chance to have it run like this?
> 
> No. You can't cancel a GUI event raised on the client from the server, 
> because requests that blocks the client javascript eventloop are now 
> impossible.
> 
>>
>> Furthermore, I found that TextArea_MouseDown and _MouseUp don't exist. 
>> These would be nice to have. Is there a technical reason they do not 
>> exist, or have they just not been implemented yet?
> 
> I don't want low-level mouse events on editing controls, because it may 
> break them. And why do you need them? I don't see any good reason.
> 

I see your point, Benoit. This is a very special case indeed. Maybe 
Bruce Steers' idea of adding java code on demand would be a way?

I wanted to keep the user from clicking somewhere and adding text (and 
from going somewhere with the cursor keys and writing or deleting any 
text anywhere). The only thing allowed is to add text at the end of the 
line.

This is for a program to train 10 fingers' typewriting.

Regards
Rolf


More information about the User mailing list