Jump to content
santiago

ToolsApi: key boardbindings in the form editor

Recommended Posts

Hello,

 

I have defined a KeyBoardBinding by implementing IOTAKeyboardBinding.

 

I register my keyboard binding using IOTAKeyboardServices.AddKeyboardBinding.

 

It is working just fine, except when I activate a DFM file (Form-Editor). If I press the shortcut keys when a DFM file is active. Nothing happens.

 

Anyone knows how to register a keybinding such that it works in the formeditor?

 

Thank you!

 

Share this post


Link to post

Its a little difficult to answer, not knowing what you are trying to achieve but editor key bindings do have limitations.

There is nothing obvious in the OTA that suggests why it doesn't work for DFM (code) however an alternative would be to install an action in the IDE and handle it from there.

You could also use the INTAEditServicesNotifier.WindowComand() to see if the keyboard binding is received by the DFM code editor.

 

Just think while rereading your message, are you referring to the form designer? If so, it's not a code editor and so will not react to key bindings so you would need to use actions.

Share this post


Link to post

@David Hoyle

Thanks for the info. I ended up using a local Keyboard hook.

 

Something which I never quite understood with the Delphi IDE was the way that Ctrl+Tab is used to switch between open tabs.

Ctrl+Tab traverses the tabs in the order in which they appear in the IDE.

For me that is not very practical, because most of the time I want to switch back to the last active tab.

 

So I then had a something simple I could work on to try out Delphi 10.4.

I did a plugin that displays a form (works very similar to what you get in Visual Studio when you hit Ctrl+Tab) when Ctrl+Tab is pressed.

 

While the Ctrl key is held down, you can press the tab key to iterate the opened tabs.

Once you release the Ctrl key the plugin will activate the selected view.

 

I now have the plugin working and have been working with it for a couple of hours. Now I can't imagine working in the Delphi IDE without it. 🙂

 

Next weekend I will open source it. Might be useful to others as well.

CtrlTabPlugin.jpg

Share this post


Link to post
2 hours ago, santiago said:

Ctrl+alt+f12 does nothing for me. 

Then it must be something other than Delphi.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×