Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


ID: 17837, Multi-line comments Keybinding for Delphi and C++ Builder

by Nafis Sadykov Email: Anonymous


Keybinding for both Delphi and C++Builder editors (versions 5 and 6). Introduces 'Ctrl+/' shortcut for fast multi-line (JBuilder-style) commenting.
Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For C++Builder, Version 5.0  to 6.0 497 downloads
Copyright: No significant restrictions


Size: 2,932 bytes
Updated on Sun, 05 May 2002 21:16:55 GMT
Originally uploaded on Tue, 23 Apr 2002 18:46:20 GMT
SHA1 Hash: EDB554233FFA7AA07594FEC2658CF15D1824620B
MD5 Hash: D979344958E53BC1254A7D2BA2BC4E8A

    Explore the files in this upload

Description
Keybinding for both Delphi and C++Builder editors (versions 5 and 6). Introduces 'Ctrl+/' shortcut for fast multi-line (JBuilder-style) commenting.

How it works: Select a text block (with a mouse) and press 'Ctrl+/' to comment/uncomment the lines contained.

Quite useful when one needs to comment and uncomment multiple lines of code often (e.g. during debugging).

Installation: just install as if you'd install a new component (pressing "Component-> Install Component" IDE menu), then compile and install the resulting package.
Note: for C++Builder - don't forget to add the path to your Builder's Source\ToolsAPI folder to your package's library path (in Project Options) to compile.

Notes on implementation:

Implementation would have been pretty straightforward except for the fact that, due to some reasons, 'Ctrl+/' shortcut (and some others) are just not caught by IDE for us when implementing IOTAKeyboardBinding in a usual way.

So we need some additional steps to take:

1) Use IOTAKeyBindingServices.SetDefaultKeyProc() to define our own callback for all the shortcuts pressed, so that we could sort them out ourselves.
That step doesn’t help much by itself. Though all the shortcuts are reported duly to our callback – ALL of them come with the same(!) KeyCode parameter (possibly due to some IOTA bug).
So, there seems to be no way of differentiating between the shortcuts in our default key procedure. Except to

2) Use GetKeyboardState() WinAPI call to check the pressed keys independently.

Using the both steps above to overcome the current IOTA key binding services limitation lets us get our 'Ctrl+/' shortcut nicely.
The rest of the code is pretty straightforward.
-------------------
06 May, 2002 - slightly improved version uploaded .

Server Response from: ETNACDC03