Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Aug 19, 2017 5:17 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Alternate Commenter for Windows
PostPosted: Mon May 13, 2013 6:15 am 
Offline

Joined: Fri Sep 30, 2005 1:53 pm
Posts: 914
Location: Philadelphia, PA
On the "Edit" menu in the IDE there is a useful feature called "Comment." "To use it, all you have to do is highlight that part of your source code that you want commented out and click on "Comment." The IDE obligingly puts an apostrophe in front of each line of the the highlighted text. (To restore the text, all you have to do is highlight the commented-out text and click on "Uncomment" on that same menu.)

Here is an alternative to the "Comment" option on the REALbasic menu. The difference is that this utility adds two forward slashes and some blank spaces ("// ") to the beginning of the lines rather than a small apostrophe (" ' "'), making the comment marks stand out more and easier to see.

This version works only with Windows because it make use of two Windows API calls, GetForegroundWindow and SetForegroundWindow. They are used to restore the focus back to the REALbasic IDE.

Here's how to use the program. Run it while in the REALbasic IDE. If you want to comment lines with forward slashes, follow these steps:

1. Select the appropriate text (using mouse and right hand).
2. Do a ctrl-X (using keyboard and left hand).
3. Click on "Comment Lines" on this program (using mouse and right hand).
4. Do a ctrl-V (using keyboard and left hand).

If you want to remove the forward slashes at the beginning of lines, follow these steps:

1. Select the appropriate text (using mouse and right hand).
2. Do a ctrl-X (using keyboard and left hand).
3. Click on "Uncomment Lines" on this program (using mouse and right hand).
4. Do a ctrl-V (using keyboard and left hand).

It's that simple, and there's a natural rhythm to it (right hand, left hand, right hand, left hand).

(Another way to highlight, of course, is to use shift and arrow keys. If you make a mistake, e.g., in highlighting the wrong text, remember that REALbasic includes a built-in Undo.)

Here's where to get the source code for the program:

http://traver.org/realbasic/commenter/commenter.rb.

The easiest way to download the program is to right-click on the preceding URL using Firefox and use "Save Link As."

The program has only a small footprint, but it does take up some space and is "always on top" (to make it readily accessible), so it is more likely to be helpful to the vision-impaired and to those who frequently comment out large blocks of text.

Enjoy!

Barry Traver


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group