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.

This article will cover the following C++ Autocomplete Features:

  • Control-Spacebar
  • Using the Selection Menu
  • Using a Dot Operator
  • Add Parameters

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

Clawbot_template.png


Control-Spacebar

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 { }.

2020-11-05_10-05-35a.jpg

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.

control_space.png

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.

2020-11-05_10-06-35.jpg

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.

‘Drivetrain’ will now appear on the line.

Drivetrain_select.png


Using the Selection Menu

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 { }.

2020-11-05_10-05-35a.jpg

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.’

2020-11-05_11-09-42a.jpg

‘Drivetrain’ will now appear on the line.

Drivetrain_select.png


Using a Dot Operator

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).’

2020-11-05_11-20-34a.jpg


Add Parameters

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

Forward.jpg

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.

2020-11-05_11-43-47a.jpg

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

2020-11-05_11-59-09a.jpg

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.

2020-11-05_11-55-59.jpg