Unable to use shortcuts (F3) when recording a MacroCommand

SyntaxEditor for Windows Forms Forum

Posted 9 years ago by Michael Dempsey - Sr. Developer, Teradata Corp
Version: 14.1.0321
Avatar

My previous editor allowed us to use shortcuts in keyboard macros.

SyntaxEditor seems to ignore keys such as F3 when recording the macro.

I am receiving complaints from my customers that they are unable to create macros like the ones they previously created since many of these require the use of a 'Find' command.

The 'Find' structure will previously have been 'primed' so that
    resultSet = SelectedView.FindReplace.Find(FindOptions)
can be called.

This is called whenever F3 is pressed.

Is there a workaround for this limitation?

Thanks
Mike

Comments (4)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Mike,

When a key is typed, SyntaxEditor will scan its CommandLinks collection to determine if there is a CommandLink that has a matching KeyBinding.  If one is found and macro recording is active, it will record the action.  There is no edit command for F3 at this time by default in our editor.  That's why F3 isn't picked up.

That being said, you could make your own EditCommand for F3 and add it to the CommandLinks collection.  I would think that if you did that, it would start to get picked up in macro recording.


Actipro Software Support

Posted 9 years ago by Michael Dempsey - Sr. Developer, Teradata Corp
Avatar

I verified that creating my own FindNextCommand (which simply calls my FindNext function in the control derived from SyntaxEditor) causes the macro recorder to record the use of a FindNextCommand, and play it back as intended.

However I dont think that's a real solution to the problem since my applications define many shortcuts and provide a command subsystem (similar to Visual Studio) which allows the user to change or add any shortcuts they want.

This means that F3 might not mean FindNext for another user, for example.

I also need to talk to the vendor of the tool that provides the command subsystem since by default it intercepts all shortcut keys defined to it and does not pass them on to the Syntax editor control, so I need to change that functionality while recording a macro.
(Unless there is a way to tell SyntaxEditor that it should get first crack at keystrokes)

The old editor I used simply recorded all keystrokes verbatim and replayed them back the same way. I think Visual Studio does the same.
So it makes no difference if there is a command bound to a function key or shortcut combination - it simply records and plays back exactly what the user did on the keyboard ... and if there is a shortcut defined (within either SyntaxEditor or the command system) then it will be processed as such when it is replayed.

Were you trying to improve performance or something when you decided to record 'commands' rather than keystrokes?

Is there an option I can switch on to tell it to record keystrokes instead?

Thanks

Posted 9 years ago by Michael Dempsey - Sr. Developer, Teradata Corp
Avatar

I have also found that Macro Playback generates errors when some of your commands are used.

For example

<EditCommand TypeName="ActiproSoftware.SyntaxEditor.Commands.ChangeCharacterCasingCommand" AssemblyName="ActiproSoftware.SyntaxEditor.WinForms"/>

generates the following exception:

System.MissingMethodException: No parameterless constructor defined for this object.
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at ActiproSoftware.SyntaxEditor.Commands.MacroCommand.ReadFromXml(XmlReader reader)
at Teradata.SQLA.Query.PlayMacro() in E:\AppSourceCurrent\SQLA\Query.vb:line 425

It looks like you make the assumption that commands do not require parameters but the CharacterCasing command requires Upper/Lower so it causes macro playback to fail if it is used within a macro.
(I would expect that changing character casing would be a common use for macros so this is a major problem.)

Once again, simply recording and playing back the Ctrl+L or Ctrl+U that I bind to these commands would not have these issues.

Mike

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Mike,

Thanks for the bug report on the character casing command in macros.  It was an oversight and we will fix that for the next build.

The way we did macros serializes the edit-related commands that were recorded exactly.  This allows you to serialize off a macro sequence and reply it later on another machine (or even the same) that might have different hotkey settings, knowing that the same command sequence will execute.  Sorry but we don't have a way to record and replay keystrokes instead.  We also are recording commands that might not necessarily come from keys and might come from menus/toolbars, etc.

If you are trying to make system wide macros with access to commands that are unrelated to SyntaxEditor, then I would recommend you use your command subsystem to possibly track everything at that level instead and reply things via that.  If you want, you could also remove all the command links we define and then map custom commands from your command subsystem to call related methods on our editor.  That way, our key handler wouldn't potentially be trapping related commands that your command subsystem was watching for.

[Modified 9 years ago]


Actipro Software Support

The latest build of this product (v24.1.0) was released 26 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.