Add Arguments to a Custom Button - 2022.2 English

Vivado Design Suite User Guide: Using Tcl Scripting (UG894)

Document ID
Release Date
2022.2 English

A custom button can have one or more arguments. Arguments are optional. After an argument is specified, a widget opens when the button is activated by the user. Arguments are defined with the command create_gui_custom_command_arg.

The syntax is:

create_gui_custom_command_arg -command_name <arg> -arg_name <arg>
                               [-default <arg>] [-comment <arg>] [-optional]
                               [-quiet] [-verbose]
  Name      Description
  -command_name Unique name of the custom command for which an argument is 
                 being created.
  -arg_name   Unique name of the custom command argument to create.
  [-default]   Default value of the custom command argument.
  [-comment]   Comment for the custom command argument.
  [-optional]  Make the custom command argument optional.
  [-quiet]    Ignore command errors
  [-verbose]   Suspend message limits during command execution

In the example below, three arguments are created for the button, myButton. The last two arguments are optional.

create_gui_custom_command -name "myButton" \
-menu_name "Do something" \
-command "myProc" \
-show_on_toolbar \
-run_proc true
create_gui_custom_command_arg -command_name "myButton" -arg_name "Top_Module" \
  -default "\[lindex \[find_top\] 0\]"
create_gui_custom_command_arg -command_name "myButton" -arg_name "Output_Directory" 
  -default "-output_dir report" -optional
create_gui_custom_command_arg -command_name "myButton" -arg_name "Force" \
  -default "-force" -optional