Book a Demo

Author Topic: Define keyboard shortcuts for built in commands  (Read 8249 times)

pssp.sven

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Define keyboard shortcuts for built in commands
« on: March 26, 2018, 10:18:43 pm »
Hello,

is it possible to define keyboard shortcuts for built in commands via an addin? Another possibility would be to define those shortcuts during the setup of the addin.

I'm not looking for custom hotkeys that are explained here https://community.sparxsystems.com/community-resources/805-triggering-add-in-functionality-with-custom-hotkeys-in-enterprise-architect in great detail.

Thanks, Sven

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Define keyboard shortcuts for built in commands
« Reply #1 on: March 27, 2018, 01:06:26 am »
Hej Sven,

In general, I'd say no. This is because most of EA's GUI functions can't be triggered through the API. So even if you can set up your Add-In to catch keyboard events, you can't then execute the functions.

There are exceptions to this, but in most cases you'd end up having to re-implement the GUI functions from scratch.


/Uffe
My theories are always correct, just apply them to the right reality.

pssp.sven

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Define keyboard shortcuts for built in commands
« Reply #2 on: March 27, 2018, 02:02:30 am »
Hi Uffe,

I appreciate your answer. My question here relates closely to my previous topic "How to select element and scroll it in visible area of diagram" (http://www.sparxsystems.com/forums/smf/index.php/topic,39398.0.html). To achieve this, I send keyboard events, which already works like a charm. I don't need to catch them (though it would be easy as described in the above linked article).

So my question still is how to define keyboard shortcuts via addin or setup, any ideas?

Thanks, Sven

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: Define keyboard shortcuts for built in commands
« Reply #3 on: March 27, 2018, 05:29:54 pm »
Hi,

if I understood you right you want to simulate/send keyboard events in your Add-In code to EA. Maybe 'How to: Simulate Mouse and Keyboard Events in Code' https://docs.microsoft.com/en-us/dotnet/framework/winforms/how-to-simulate-mouse-and-keyboard-events-in-code could help.

With this you can send keys to arbitrary applications, and I think to your own (EA). I haven't tried it yet but it should work.

Best regards,

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

pssp.sven

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Define keyboard shortcuts for built in commands
« Reply #4 on: March 27, 2018, 07:06:19 pm »
Hello Helmut,

thanks a lot for your answer, but as I already mentioned above sending keystrokes works like a charm. I'm using Windows Input Simulator to do that. You can find it here: https://archive.codeplex.com/?p=inputsimulator

Maybe I'm not able to articulate my problem properly.  :-\

What I would like to achieve is defining keyboard shortcuts for EA. Take for example the Zoom in command.
I would like to map the Zoom in command to the shortcut Ctrl++.

I believe - but I'm not sure - that the shortcuts are stored in the registry. If so, where exactly does EA store those keyboard shortcuts? Could it be this regpath HKEY_CURRENT_USER\Software\Sparx Systems\EA400\EA\EA1200Workspace\BCGToolbarParameters with the value CommandsUsage?
(I know how to write or read to the registry. So this won't be any problem.)

Or does EA store the keyboard mappings anywhere else? You see, I'm lost and I greatly appreciate any help. Perhaps there do exist some undocumented API functions to redefine the mappings? ...
Nevertheless thanks to Helmut and Uffe so far.

Best regards, Sven

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Define keyboard shortcuts for built in commands
« Reply #5 on: March 27, 2018, 07:14:07 pm »
Look at Tools/Customize/Keyboard. That's all EA offers.

q.

pssp.sven

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Define keyboard shortcuts for built in commands
« Reply #6 on: March 27, 2018, 07:40:32 pm »
Hi querty,

thanks for your answer. Yes, I've used Tools/Customize/Keyboard of course to define the shortcuts manually.
What I need is a way to automate this task. But that's obviously not possible.
I'll investigate this subject some more and will post here about my findings. There must be a way... ;)

Thanks, Sven

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Define keyboard shortcuts for built in commands
« Reply #7 on: March 27, 2018, 08:03:37 pm »
"That's all" means: there is no way in the automation.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Define keyboard shortcuts for built in commands
« Reply #8 on: March 27, 2018, 09:02:07 pm »
Have you tried looking in the registry?
If the settings are local to a user they are usually stored in the registry.

So if you wanted to automatically set some of the keyboard shortcuts you could edit the registry.

Geert

pssp.sven

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Define keyboard shortcuts for built in commands
« Reply #9 on: March 28, 2018, 01:36:33 am »
Hi Geert,

yes, I did look at the registry, especially this part: HKEY_CURRENT_USER\Software\Sparx Systems\EA400\EA\...
But even with tools like Process Monitor or Regshot I couldn't monitor or find any changes.
Is there any other good place you could imagine where EA could store settings like the keyboard mappings?

Thanks, Sven

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Define keyboard shortcuts for built in commands
« Reply #10 on: March 28, 2018, 02:00:03 am »
There's always the user's profile, by default
C:\Users\<user>\AppData\Roaming.

/Uffe
My theories are always correct, just apply them to the right reality.