Table of Contents Previous page Next page Index

ModelSim Documentation Bookcase

Model Technology Inc.


Example 2 - Execute a procedure using a push button

Before you begin this example make sure you have completed "Initial setup" .

This example will display all of the gif images in the images directory. Each button has a binding attached to it for "enter" events, and a binding for a mouse button press. When the mouse enters the button graphic, the image file name is printed to the Main window (or invoking shell on UNIX). When the mouse button is pushed, its "widget" name will be printed to the Main window (or invoking shell on UNIX).

  1. Build an image viewer by invoking this command, and calling this procedure:

  2. 
    source images.tcl
    image_example 
    
    
  3. Drag the mouse across the buttons and notice what happens in the Main transcript (or invoking shell on UNIX).

Push one of the buttons; you will see an error dialog box. You can solve this problem by modifying the images.tcl file.

  1. To view the source file press the See Source Code button at the bottom of the image display or invoke notepad at the ModelSim prompt:

  2. 
    notepad images.tcl 
    
    

You'll find that the pushme procedure is missing; it's commented out in images.tcl.

  1. Search for "proc push" using the Edit > Find menu selection in the notepad.

Remove the comments (the "#" symbols) to return the function to your source, use File > Save to save the changes, then close the image window with the Destroy button.

  1. Once the pushme procedure is in place it will print its one parameter, the object name, to the transcript.

  2. After you have added the pushme procedure to your source, you need to resource and rerun the Tcl procedure with these commands (use the up arrow to scroll through the commands or do !source):

    
    source images.tcl 
    image_example 
    
    

Press all the buttons and notice the object names in the Main transcript. Close the image 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