DataView.IsExistingActionMenuItem

Prototypes

boolean IsExistingActionMenuItem( String sItem )

Return Value

If the specified item exists on the action menu, the return value is true. Otherwise, the return value is false.

Parameters

String sItem
An item that potentially exists on the action menu.

Remarks

Use this method to determine whether a particular item exists on the action menu.

The string sItem may refer to a menu item, a separator, or a cascading menu item. For example, if "Cascade\nMenu Item"J is an existing menu item, this method returns true if sItem = "Cascade" or sItem = "Cascade\nMenu Item"J. The method returns false if sItem = "Cascade\n"J.

Example
declare DataObject dobj;
dobj = DataObject.CreateFromFile( "gpa" );

declare ScatterPlot plot;
plot = ScatterPlot.Create( dobj, "SATV", "SATM" );
plot.SetMarkerSize( 5 );
plot.AppendActionMenuItem( "Add SAT Contours",
    "run AddSATContours;" );

/* Add lines of constant total SAT scores (math + verbal) */
start AddSATContours;
    /* If the 'Remove' item exists, the contours are
       already drawn */
    if plot.IsExistingActionMenuItem( "Remove SAT Contours" ) then
        return;

    /* if they aren't drawn, draw them */
    plot.DrawUseDataCoordinates();
    plot.DrawSetPenColor( 0xd0d0d0 ); /* light gray */
    levels = do(600, 1600, 100);
    plot.DrawLine( 0*levels, levels, levels, 0*levels );

    /* label contour lines with the total SAT score */
    plot.DrawSetTextColor( 0x808080 ); /* dark gray */
    do i = 1 to ncol(levels);
        if ( levels[i] <= 1000 ) then
            plot.DrawText( levels[i]-300, 300, char(levels[i],4) );
        else
            plot.DrawText( 750, levels[i]-750, char(levels[i],4) );
    end;

    /* Create a menu item to remove the contours.
       When selected, the item will itself be removed! */
    plot.AppendActionMenuItem( "Remove SAT Contours",
        "plot.DrawRemoveCommands();
    plot.RemoveActionMenuItem( 'Remove SAT Contours' );" );
finish;
/* Press F11 in the plot window and select the menu item. */
See Also

DataView.AppendActionMenuItem
DataView.RemoveActionMenuItem