[Gambas-user] Keystroke recorder for the IDE :)
Bruce Steers
bsteers4 at gmail.com
Sun May 7 11:18:18 CEST 2023
On Sat, 6 May 2023 at 18:45, Jussi Lahtinen <jussi.lahtinen at gmail.com>
wrote:
> I have never used the feature either, but that actually looked quite
> handy. I guess with little practice it will be useful.
>
Yes indeed, some crafty use of ctrl and shift to move to or select single
words with the ability to cut/copy/paste then finishing off with
positioning to the next line to process can shorten many a laborious task.
many many moons ago when i coded on my Amiga1200 i had a keystroke recorder
and because there was nothing like X11/QT/GTK//wayland the recorder would
playback with any program, I used it often and found it very useful.
I tried to make one previously for my editor that worked but was not great
as it used X11.SendKey() so didn't work on wayland and behaved differently
with gtk or qt.
This new way of a copy of TextEditor_KeyPress converted to use MacroKey is
much better and seems to work well on all systems.
It's got a problem when recording though with menu shortcuts hiding
keypress events from TextEditor.
It only handles menu Action events that are handled in the Form_Keypress,
other menu events with shortcuts not handled in KeyPress are missed.
I've worked around it in my own program by manually adding a MacroKey of
the shortcut in it's relevant menu event.
like this..
Public Sub mnuFindNext_Click() ' IDE menu shortcut of F3 that
TextEditor_KeyPress() does not see
Dim hMacro As Macro = ActiveEditor()._GetMacro()
If hMacro And If hMacro.State = Macro.Recording Then
hMacro.AddShortcut("F3")
FindNextText()
End
Not going to be so easy to do this for gambas IDE i think with many preset
shortcuts.
It needs something like...
* Menu shortcut key events not being missed by TextEditor_KeyPress
possibly a static Menu.ShortcutKeyEvents property that would skip the Stop
Event happening?
or
* some kind of Shortcut_Activate() event fired when any menu shortcut is
triggered
* something like a Control_Shortcut() event
Maybe there is already some trick or something i'm missing?
Respects
BruceS
Jussi
>
> On Sat, May 6, 2023 at 6:18 PM Bruce Steers <bsteers4 at gmail.com> wrote:
>
>>
>>
>>
>> On Sat, 6 May 2023 at 11:47, Benoit Minisini <
>> benoit.minisini at gambas-basic.org> wrote:
>>
>>> Le 03/05/2023 à 13:31, Bruce Steers a écrit :
>>> >
>>> > Is this not anything of interest to you Ben?
>>> >
>>>
>>> Personnally I have never used a macro recorder. Do you have some example
>>> of what you used it for?
>>>
>>
>> It can be very useful for various things, if you have any repetitive
>> keyboard task to do.
>>
>> An example here where i use it to quickly set some Key variables from
>> their Property definitions.
>> Normally each line would have to be manually written. with the recorder I
>> can copy-n-paste the property definitions, start the recorder, then edit
>> one line and position to the next. then play the macro for all the other
>> lines.
>> https://youtu.be/LC-8qEMFGsA
>>
>> I also gave a little explanation of it's usefulness and posted an example
>> video on the gambas.one forum where i quickly change a long list of
>> Key.Code values into a Collection.
>>
>> I think both clips show how a feature like this has some potential to be
>> very handy.
>>
>> Other uses could be in converting snippets of code from another languages
>> into gambas.
>>
>>
>>
>>> Anyway, I think that being able to forge key or mouse events would be
>>> helpful for such a feature.
>>>
>>
>> Yes very much so. then all the TextEditor KeyPress events would not need
>> to be copied and converted (and thought about if changes are made)
>>
>>
>>>
>>> I will think about that.
>>>
>>
>> Many thanks kind sir :)
>>
>>
>> I have a couple of other issues at present.
>> I have gb.form.editor imported to my text editor program (the 1st clip
>> above) and i also have incorporated it into the IDE but it's not so good.
>> They both use Observer.class to observe the texteditor control.
>>
>> In both uses the F3 keypress cannot be detected, i think the menu
>> shortcut is swallowing it up. F3 is super useful with macros as you may
>> often make the last keystroke to be a search for the next occurrence of
>> your edit.
>>
>> It seems just with the IDE Ctrl-C, V, X presses are also not detected,
>> but they are in my program.
>> I assume again a menu shortcut is hiding the event somehow so
>> TextEditor_KeyPress() does not get it.
>>
>> I need to workaround detecting the missing keypress events somehow. (if
>> at all possible)
>>
>> Much respect
>> BruceS
>>
>>
>>> Regards,
>>> --
>>> Benoît Minisini.
>>>
>>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>>
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230507/939adb9e/attachment.htm>
More information about the User
mailing list