Table of Contents Previous page Next page Index

ModelSim Documentation Bookcase

Model Technology Inc.


add button

The add button command adds a user-defined button to the Main window button bar. New buttons are added to the right end of the bar. You can also add buttons with a ModelSim tool: "The Button Adder" .

Returns the path name of the button widget created.

Syntax

add button

<Text> <Cmd> [Disable | NoDisable] [{option value ...}]

Arguments

<Text>

The label to appear on the face of the button. Required.

<Cmd>

The command to be executed when the button is clicked with the left mouse button. To echo the command and display the return value in the Main window, prefix the command with the transcribe command. Transcribe will also echo the results to the transcript window. Required.

Disable | NoDisable

If Disable, the button will be grayed-out during a run and not active. If NoDisable, the button will continue to be active during a run. Optional. The default is Disable.

{option value ...}

A list of option-value pairs that will be applied to the button widget. Optional. Any properties belonging to Tk button widgets may be set. Useful options are foreground color (-fg), background color (-bg), width (-width) and relief (-relief).

For a complete list of available options, use the configure command addressed to the newly-created widget. For example:

.controls.button_7 config


Note: Because the arguments are positional, a Disable | NoDisable option must be specified in order to use the options argument.

Examples

add button pwd {transcribe pwd} NoDisable

Creates a button labeled "pwd" that invokes the transcribe command with the pwd Tcl command, and echoes the command and its results to the Main window (see graphic below). The button remains active during a run.

add button date {transcribe exec date} Disable {-fg blue -bg yellow \
activebackground red}

Creates a button labeled "date" that echoes the system date to the Main window. The button is disabled during a run; its colors are: blue foreground, yellow background, and red active background.

add button doit {run 1000 ns; echo did it} Disable {-underline 1}

Creates a "doit" button and underlines the second character of the label, the "o" of "doit".

.controls.button_7 config -command {run 10000} -bg red

Changes the button command to "run 10000" and changes the button background color to red.

See also

transcribe, "The Button Adder" tool


Model Technology Inc.
Model Technology Incorporated
Voice: (503) 641-1340
Fax: (503)526-5410
www.model.com
sales@model.com
Table of Contents Previous page Next page Index

ModelSim Documentation Bookcase