LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

commenting and code format

I'm using CVI8.1.1. Is there a way to comment out multiple lines of code with a single shortcut-key? Obviously I can always /* comment out things like this */. But it sure would be nice to highlight the code and just hit a key.
 
Also, are there any code alignment tools available in CVI? I have a messey programmer on my hands that doesn't know how to use the tab-key to save his life. Any suggestions?
 
Thanks,
Craig
0 Kudos
Message 1 of 15
(7,377 Views)
Ctrl-E will exclude lines of code from the build.  Can't help you with your programmer problem.
0 Kudos
Message 2 of 15
(7,369 Views)

Ctrl-E excludes lines of code but this is only a temporary fix. As soon as the project is unloaded this excluded lines are reset. I'm talking about commenting out the code. I guess I'll assume that its either /*comment*/ or temporarily exclude.

Obviously you cannot help me with the person who writes the code. The second question regarding code format is an attempt at improving my understanding of CVI. Part of that is learning about different ways to move code around regarless of whos been assigned to the project with me. Anyone else with suggestions?

 

Craig

 

0 Kudos
Message 3 of 15
(7,359 Views)
Hello Craig.
 
Here are a few tips on text selection & manipulation in the CVI source editor (you may already be aware of many of these):
  • use Ctrl + Ins to toggle between character, line & column selection modes
  • select text in the usual way using mouse and/or keyboard
  • a triple mouse click selects an entire line
  • use Ctrl + B ("balance" command) to select all text between matching parentheses / braces / brackets; repeat to expand to the next level
  • move or copy selected text to another location by dragging with the mouse
  • increase / decrease the indentation of selected text using Tab / Shift + Tab

Also:

  • have a look at Editor Preferences and Bracket Styles under the Options menu when a source file is open
  • read the Using LabWindows/CVI / Writing Source Code topic in CVI Help
  • check out Debugging and Editing Tools... on the NI Developer Zone web pages

Good luck.

Colin.

 

Message 4 of 15
(7,346 Views)

When you go to close a file that has excluded lines CVI will give you several options:

1) You can comment out the lines.

2) You can #ifdef them out

3) You can unexclude them

0 Kudos
Message 5 of 15
(7,322 Views)
This is one of the few things I miss in the CVI IDE;
Keyboard shortcuts to comment out blocks or remove "comment slashes" from blocks of code..
I'm using the CTRL+E extensively, but it comes to short when I have a block of code that have previously been commented out (using CTRL+E, selecting "comment out" upon closing the file). I know I can hit CTRL+INS twice and select the comments, but other IDE's I have been using normally has an option to comment out/uncomment a block of code. Can't be very difficult to implement I reckon..
---
Best regards
Peder Schmedling
0 Kudos
Message 6 of 15
(7,295 Views)
Peder and others,
 
I just want to point out that CVI has a macro feature in the editor that allows you to define some complex keystroke sequences and then assign a shortcut key to them. That might be useful in your case.
 
To record a macro, use Tools>>Source Code Macros>>Record Macro. You can experiment with it and see if you can create a macro that will do what you need.
 
Luis
0 Kudos
Message 7 of 15
(7,275 Views)
These new suggestions are very helpful. Thank you!
 
Craig
0 Kudos
Message 8 of 15
(7,272 Views)
Whenever I want to create a macro I feel that I'm "blind"..
Instead of recording source code macros, I want to write them.. Is there any documentation available on the various commands? I can't seem to find any information/reference in the help files..

I don't think it's possible to record a macro which does exactly what I describe, but if I could get an overview of what macro commands are available..
---
Best regards
Peder Schmedling
0 Kudos
Message 9 of 15
(7,209 Views)

Hello Peder,

Unfortunately it is not possible to "write" a macro in the way that you're describing, which is why the macro language is not documented. You can only record macros.

Are you sure that it isn't possible to record a macro to do what you need? If you're not sure whether it's possible or not, I would suggest that you try to describe here what you need to do, and we will try to help you, if it's at all possible.

Luis

0 Kudos
Message 10 of 15
(7,191 Views)