Example: Print to the Transcript
Test by printing results to the Transcript windowTest by printing results to the Transcript windowNo tips for this topicNo example for this topicDebug my scriptsDebug my scripts
Suppose you have an application that has the following view:
Sample Date Display application
Further suppose that you want the month, day, and year values given in the spin buttons on the top of the window to show in the Date text fields on the bottom of the window when the Display Date push button is pressed. But, unfortunately, your connections aren't giving the results that you want.
One way to test what values the spin buttons and text fields have is to print specific values to the System Transcript.
To print the values for the Month spin button and the DateMonth (left) text field:
1. Go to the Script Editor and add a script such as testMonth below which gets the values and prints them to the System Transcript.
"Print month values for Month drop-down
list (m1) and DateMonth (m2) text field."
| m1 m2 |
m1 := (self subpartNamed: 'Month') object.
m2 := (self subpartNamed: 'DateMonth') object.
Transcript cr; show: m1 printString.
Transcript cr; show: m2 printString.
2. In the Composition Editor, connect the clicked event of the Display Date push button to the script:
a. Select clicked from the push button's pop-up menu.
b. Click the mouse cursor, which shows spideron the free-form surface.
c. In the displayed pop-up menu, select Event to Script.
d. In the displayed window, double-click on testMonth.
The event-to-script connection will appear as a bright green arrow (see the graphic above).
Now, when you run the application and click on Display Date, the values for the Month spin button and the DateMonth text field print to the System Transcript. A nil value indicates that the settings for the part are wrong, or that the connections aren't enabling the part to get the correct value.
Change the settings or connections and rerun your application until you get the results you want.
Last modified date: 08/12/2019