Using the C++ Autocomplete feature while creating a C++ project in VEXcode V5 can help save time and prevent errors when typing commands.
Note: This project uses the Clawbot (Drivetrain, 2-motor, No Gyro) template.
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 { }.
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.
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.
‘Drivetrain’ will now appear on the line.
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 { }.
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.’
‘Drivetrain’ will now appear on the line.
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).’
Add Parameters
Parameters are the options that are passed to the command between the parentheses. For this example select ‘forward.’
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.
Be sure to close the command syntax with a close parenthesis and a semicolon.
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.