[Gambas-user] is it possible to non-virtualize Key.class

Bruce Steers bsteers4 at gmail.com
Fri Mar 24 02:29:10 CET 2023


On Thu, 23 Mar 2023 at 22:42, Bruce Steers <bsteers4 at gmail.com> wrote:

>
>
> On Thu, 23 Mar 2023, 22:08 Benoit Minisini, <
> benoit.minisini at gambas-basic.org> wrote:
>
>> Le 23/03/2023 à 21:00, Bruce Steers a écrit :
>> > Could it be possible to non-virtualize Key.class ?
>> >
>> > I tried to make a Key.class and added variables for the properties and
>> a
>> > way to have it either give the usual Key data or the set data.
>> >
>> > The hope was i could set the variables then trigger a KeyPress event of
>> > an object and it could read the fake details.
>> >
>> > But it failed with "no Keyboard event data"
>> >
>>
>> Yes, there is no way to forge fake input events in GUI components.
>>
>> --
>> Benoît Minisini.
>>
>
> That's a shame.
> Could there be? 😉
>
> I've been doing it differently by importing the whole gb.form.edit source
> and I copied the View_Keypress method of TextEditor.class and converted it
> to a MacroKeyPress method that does not use Key properties only constants.
>
> But it got complicated as I need to follow up the super.keypress ladder
> for all .mode files.
>
> Having a non virtual Key.class overriding properties would be incredibly
> useful.
>


Hold the phone...
Actually Copying the KeyPress / OnKeyPress methods and changing to be
MacroPress / OnMacroPress methods has worked surprisingly well..

downside is i have to have a complete copy of gb.form.editor source so i'll
have to update manually if the main updates.
and the KeyPress/MacroPress and OnKeyPress/OnMacroPress methods are almost
identical code except less a few dots (i changed properties like Key.Text
into KeyText)

upside is I currently have pretty good control of manually faking
TextEditor keyboard presses that I previously recorded.

:D

Overriding Key.class would have been the simplest way.  but i guess my
Key.class file does not get checked first like if I have a TextEditor.class
file it is looked at before the inherited Super TextEdior.class.
If my custom Key.class file did that maybe it would/could work?  or is it
just bad, ie for security n stuff, just a no no?

I think there could be other usefulness of being able to manually set the
Key.class properties before manually running a method that expects the
virtual Key to exist.

But hopefully what i'm doing right now will be a much better macro recorder
than the x11 version i previously made.

Respects
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230324/540b3430/attachment.htm>


More information about the User mailing list