Using the C++ Autocomplete Feature in VEXcode V5

Using the C++ Autocomplete feature while creating a C++ project in VEXcode V5 can help save time and prevent errors when typing commands.

Clawbot Drivetrain 2 motor example project thumbnail.

Note: This project uses the Clawbot (Drivetrain, 2-motor, No Gyro) template.


Control-Spacebar

VEXcode V5 C++ project with the space inside the main() function on line 17 highlighted.

One way to start using the C++ Autocomplete feature is with the Control-Spacebar shortcut on Windows, macOS, and Chrome OS.
To start, select the first open line in the int main () braces { }.

VEXcode V5 C++ Workspace with a dropdown menu of all suggested commands. A scroll bar is available to scroll through the options.

Use the Control-Spacebar shortcut (by selecting the control key and the Spacebar at the same time). The device or command name will appear in a drop down selection menu.

VEXcode V5 C++ Workspace with a dropdown menu of suggested commands. The Drivetrain command is highlighted.

Press ‘Enter/Return’ or ‘Tab’ on your keyboard or select the command with your cursor to make a selection. In this example, ‘Drivetrain’ is selected.

Note: With longer selection menus, you can make a selection using one of the following options:

  • Use your “Up” and “Down” keys to select the name you want, then press “Tab” or “Enter/Return” on your keyboard to make the selection.
  • Use your cursor to scroll up and down in the Autocomplete menu. Then make the desired selection.

VEXcode V5 C++ project with the Drivetrain option selected in the dropdown menu and now pasted into the workspace.

‘Drivetrain’ will now appear on the line.


Using the Selection Menu

VEXcode V5 C++ project with the space inside the main() function on line 17 highlighted.

If you know the command you are going to use, another method to use the Autocomplete feature is to select the first open line in the int main () braces { }.

VEXcode V5 C++ Workspace with a dropdown menu of suggested commands. The letter D has been typed and the keyboard is being used to step through the available commands. Drivetrain is the first suggestion and it is highlighted.

Begin typing the command. In this example, enter ‘d’ for Drivetrain. The device or command name will appear in a drop down selection menu. Select, ‘Drivetrain.’

VEXcode V5 C++ project with the Drivetrain option selected in the dropdown menu and now pasted into the workspace.

‘Drivetrain’ will now appear on the line.


Using a Dot Operator

VEXcode V5 C++ Workspace with a dropdown menu of suggested commands. The Drivetrain device and a dot operator have been typed and the keyboard is being used to step through the available commands. The Drive For command is highlighted.

Adding a dot operator (a period, ‘.’) will open a new menu of all commands available to the device. For this example select, ‘driveFor(direction, distance, units).’


Add Parameters

VEXcode V5 C++ Workspace with a dropdown menu of suggested commands. The command Drivetrain.driveFor has been typed with a leading perenthesis, and parameters for that function are available in the menu. The first parameter option reads forward.

Parameters are the options that are passed to the command between the parentheses. For this example select ‘forward.’

VEXcode V5 C++ Workspace with a dropdown menu of suggested commands. The command Drivetrain.driveFor(forward, 100, has been typed with a blank final parameter, and parameters for that part of the function are available in the menu. The second parameter option reading mm is highlighted.

Some commands require multiple parameters. Use a comma to separate different parameters in the same command. Some parameters are values and a drop down menu will not appear. For example with the ‘Drive for’ command, enter ‘100,’ for the second value. Ensure that a comma is added after the value for a drop down to appear for the next parameter or unit.

VEXcode V5 C++ Workspace with a completed command that reads Drivetrain.driveFor(forward, 100, mm); and the ending close perenthesis and semicolon are highlighted.

Be sure to close the command syntax with a close parenthesis and a semicolon.

VEXcode V5 C++ Workspace with a completed command that has an optional parameter at the end and reads Drivetrain.driveFor(forward, 100, mm, false);

Some parameters are optional, such as the ‘false’ in the following example. For more information about parameters, view the command’s Help information to determine which parameters are needed, and which are optional.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: