Table of Contents Previous page Next page Index

ModelSim Documentation Bookcase

Model Technology Inc.


Example 1 - Create a "Hello World" button widget

Before you begin the examples make sure you have completed "Initial setup" .

In this example you will study a "hello world" button that prints a message when pressed.

  1. Source the Tcl file from the ModelSim prompt:

source hello.tcl  

then run the procedure defined within hello.tcl:

hello_example  

The file hello.tcl was read into the ModelSim Tcl interpreter. The instructions in the hello_example procedure were then executed by ModelSim, and "Hello World" was printed to the Main transcript (or invoking shell on UNIX). Selecting the button will print the message again.

You've just created your first top-level widget!

  1. Invoke the hello_example procedure again and notice how the new button replaces the original button. The procedure destroyed the first button and created the new one. Get a closer look at the source Tcl file with the notepad:

notepad hello.tcl 

Close the hello_example window when you're done.


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