LabWindows/CVI User Group Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

LabWindows/CVI Tip: CVI Tip of the Day

Summary

In versions of LabWindows/CVI prior to version 8.1, a tip of the day would pop up in a dialog box on each launch of LabWindows/CVI. These tips of the day were pulled from a tipoftheday.ini file that listed 63 CVI tips and tricks useful for both beginner and experienced developers. While the tip of the day feature was removed for a few different reasons, the tips still prove useful to many LabWindows/CVI developers. Those original 63 tips and tricks are listed below:

LabWindows/CVI Tips of the Day

  1. The \samples folder of your installation contains numerous helpful sample projects.
  2. An Instrument Driver is a library of functions with an associated FP file.  The FP file defines the Function Tree of Function Panels, and points to particular code and header files with the same base names. The code for the instrument can be in a source file, an object file, or a library file.
  3. The LabWindows/CVI CodeBuilder allows you to generate working application code from the UIR Editor window.
  4. To link other vendors' compiled object files, static libraries, or import libraries into your application, just add them to your project.
  5. Right-clicking on Function Panels and their parameter controls will display useful help information.
  6. The contents of the LabWindows/CVI menus change depending on which window you are in.
  7. In most of the LabWindows/CVI windows, you can right-click the mouse to display a context-sensitive shortcut menu.
  8. Use the "View" menu from a Source Editor window to navigate to function panels and even UIR file objects.
  9. Every time you save a UIR file in the UIR Editor, LabWindows/CVI will update the associated header file.  You should not modify this header file, which will have the same base name as your UIR file.
  10. You can view the keyboard shortcuts in the Help menu of the source editor windows under Keyboard Help.
  11. The Source Editor, Function Tree Editor, and UIR Editor windows offer advanced searching capabilities (use the "Edit" menu).
  12. The project window allows you to select multiple files and then perform batch operations such as Remove or Compile.
  13. You can replace a file in the project by right-clicking on the file and selecting the corresponding menu item.
  14. While execution is suspended, holding the mouse cursor over a variable or highlighted expression in a source window, or in a function panel, will display the value of the variable or expression.
  15. Use the "Threads..." menu item in the "Run" menu to view the threads in your program and to switch to viewing the call trace and local variables of another thread.
  16. Turn on the "Go to source after inserting code from function panel" option in the Environment Options dialog to have LabWindows/CVI automatically close the function panel window after inserting code into a source window.
  17. Switching between the Release and Debug Configurations allows you to build debug or release (standalone) executables, DLLs, and static libraries. Use the "Configuration" menu item in the "Build" menu of the project window to switch between Release and Debug Configurations.
  18. The LabWindows/CVI Standard I/O window does not refresh when a program is suspended.  You can use a Windows console window instead of the LabWindows/CVI Standard I/O window by checking the "Use Console Window for Standard I/O when Debugging" Environment option.
  19. Use the Utility Library function ErrorPrintf to output debug information to the LabWindows/CVI Run-Time Errors window.
  20. When creating function panels, use CTRL-T in a function panel ring control or binary control to change it into an input control.
  21. Files can be added to a project by the drag and drop method.  Just select any file, press and hold the left mouse button, and drag the file to the project window.
  22. The \toolslib folder of your LabWindows/CVI installation contains numerous useful Instrument Drivers.
  23. With your cursor over a function, macro, or variable definition in a Source Editor window, CTRL-I will bring you to its definition; CTRL-SHIFT-I will cycle through its references.
  24. Use CTRL-E in a Source Editor window to toggle the exclusion of selected lines.
  25. With the cursor over a LabWindows/CVI library function call, you can press CTRL-P to display the associated Function Panel.
  26. CTRL-SHIFT-P in a Source Editor window will let you search for a Function Panel based on the text you enter.
  27. Use CTRL-B in a Source Editor window to find matching braces, brackets, or parentheses.
  28. From a Function Panel, press SHIFT-F8 to navigate back to the Function Tree.
  29. With a variable highlighted in a Source Editor window, use SHIFT-F7 and CTRL-F7 to display the variable's contents in the Variables and Watch windows.
  30. CTRL-SHIFT-F3 in a Source Editor window will make selected text or the text under the cursor the current search context (subsequent F3 usage will search for the new text).
  31. You can use the Project window's "View" menu to change the way in which you organize your project files.
  32. The "Format" menu in the Variables and Watch windows lets you specify the numeric format of the data you are viewing.
  33. Pressing ENTER with your cursor in a Function Panel parameter control that expects predefined constants will display a list of available constants.
  34. CTRL-A in a Function Panel parameter control displays a list of variables and expressions.
  35. Right-clicking on the LabWindows/CVI taskbar icon, while you are debugging a program, allows to display the CVI project window; from there you can interrupt the execution of you program.
  36. CTRL-SHIFT-UPARROW and CTRL-SHIFT-DOWNARROW will navigate up and down the current call stack while execution is suspended.
  37. Use the Estimate Variable Size item from the "Run" menu of the Watch or Variables window to specify the size of a dynamically-allocated memory block.
  38. You can control the message-polling rate of your application with the Utility Library's SetSleepPolicy function.
  39. You can export the Variables and Watch displays to file by selecting "Output..." from the "File" menu.
  40. If ATTR_ENABLE_ZOOM_AND_PAN is enabled on a graph, CTRL-Left click will zoom in, CTRL-Right click will zoom out, and CTRL-SHIFT while dragging will pan the graph viewport.
  41. Use the Function Tree Editor's "Generate New Source For Function Tree" command to automatically generate source code shells for the functions in your instrument driver.
  42. Turn on the "Enable Auto Replace" option in the Function Tree Editor to have LabWindows/CVI automatically update your function definitions to reflect changes you make to function panel names in your instrument driver.
  43. You can create columns and colored text in a list box by embedding escape codes in the Item Label parameter.  See the function panel help for InsertListItem.
  44. Use the "View" menu from the Variables, Watch, or Array Display Windows to view the contents of a 1-dimensional or a 2-dimensional array.
  45. You can right-click on any menu in LabWindows/CVI to obtain help for that menu. You can also obtain help by pressing F1 while navigating the menu.
  46. In a Source Editor window, pressing F1 when the cursor is over a keyword will search the LabWindows/CVI Online Help for help related to the keyword.
  47. You can obtain help for a given control type by right-clicking on an instance of that control in the UIR Editor window.
  48. Use the User Interface Localizer, available from the Tools menu, to translate your user interfaces into multiple languages.
  49. Use the UI To Code Converter, available from the Tools menu, to generate code from a uir file that will programmatically create your user interface. This enables you to not have to distribute the uir file with your executable.
  50. You can save a particular configuration of a control as a custom control. See the Edit Custom Controls dialog from the UIR Editor window's Edit menu.
  51. In the Edit ActiveX Server tool, you can import ActiveX interfaces into an ActiveX server from other LabWindows/CVI ActiveX server specification files.
  52. In the Edit ActiveX Server tool, you can import ActiveX methods into ActiveX interfaces based on the function prototypes in a C header file.
  53. You can create minimal LabWindows/CVI DLLs for use in the LabVIEW Real-time platform by setting the Runtime Support option in the Target Settings dialog to LabVIEW Realtime Only.
  54. You can use the _LINK_CVIRTE_, _LINK_INSTRSUP_, and _LINK_CVI_LVRT_ predefined macros to write code that will be conditionally compiled based on the LabWindows/CVI runtime support option selected in the Target Settings dialog.
  55. If your project does not use LoadExternalModule, you can uncheck the Enable LoadExternalModule option in the Target Settings dialog. This will result in smaller executables and dlls and faster startup time.
  56. You can set the base address of a dll through the Image base address field in the Build Options dialog.
  57. You can look at the preprocessed output of your source files by selecting Preprocess Source File from the Source Editor window's Options menu. You can use this functionality to verify that your macros expand properly.
  58. In addition to the __FILE__ and __LINE__ macros, you can use the __FUNCTION__ macro to obtain the name of the current function for error reporting.
  59. LabWindows/CVI can detect uninitialized local variables at compile and runtime. You can enable these warnings in the Build Options dialog.
  60. LabWindows/CVI can detect assignments in if-, while-, for-, and do-while-statements to help catch errors where you actually mean to compare for equality (==). You can enable this warning in the Build Options dialog.
  61. Source code browsing provides a convenient cross reference for your program listing all functions, variables, types, etc. You can enable this option in the Build Options dialog and use it from the Tools menu.
  62. LabWindows/CVI provides tools for easily interacting with MS Excel and MS Word, through ActiveX Automation. Look for these tools in the following example programs: cvi\samples\activex\excel\ExcelReportDemo.prj, and cvi\samples\activex\word\WordRpt.prj
  63. In the UIR Editor window, you can set a group of controls to the same size by selecting them, then hitting SHIFT-F10, then specifying the desired height and width, and finally clicking on the corresponding "All" buttons.

Did you find this tip useful? Rate this document or add a comment below.

If you give these a try, share your experience! Add a comment below.

Collin D.
Software Product Manager
Contributors