[Gambas-user] WebTextArea vs. TextArea controlling events

Benoit Minisini benoit.minisini at gambas-basic.org
Thu Sep 29 13:49:23 CEST 2022


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.

-- 
Benoît Minisini.



More information about the User mailing list