Examine Data

Step in Source Code Tutorial Contents Work with Threads
  1. Select the variable this on line 64 in the Source Panel.

    A large popup label for the variable (an instance of QuickMenu) appears.

  2. Click the Examine button.

    <PIC>

    The Data card displays the object this (an instance of the QuickMenu applet class) in the Data card as a table of variables and values.

    <PIC>

    You can view variables in different ways. For example, you can view an object's type as well as its structure.

  3. Choose Type from the option menu above the table.

    The display now shows that the variable this is an object of type QuickMenu.

  4. Choose Structure from the option menu.

  5. Scroll down the table to the menulinks array.

  6. Double-click the value field (the right column of the table) to display the array contents as a table.

    <PIC>

    You can view the values of any variables as you step through source code or stop at different breakpoints.

  7. In the table on the right side of the Data card, type menuwidth on the first row and i on the second row.

    Notice that the right column of the table displays the values of menuwidth and i.

  8. Press the left mouse button with the cursor over the Data card tab, drag the cursor off the Cosmo Code window and release the mouse button.

    You have created a copy of the Data card. This is useful when you want to track events in two cards at the same time. For example, you might want to view the callstack and variable values at the same time.

  9. Switch to the Callstack card.

    Notice the callstack values for the current stopped thread, applet-QuickMenu.class.

  10. Click the Step Over button a few times.

    The variable values on the Data card change as you step. The Callstack card updates to show the line number for the most recently executed line in the init method.

    You can now delete the breakpoint you created and rerun the fixed applet.

  11. Click the breakpoint icon in the Source panel to delete it.

  12. Click the Run button above the Source panel to terminate execution of the current program, recompile, and run the fixed applet.

    Now the menu outline should be the correct width.

    Step in Source Code Tutorial Contents Work with Threads

    Guide to the Cosmo Code Development Environment
    12-96*161