DataView.GetInitiator

Prototypes

static DataView GetInitiator()

Return Value

If the current program execution was started by an action menu item, the return value is a reference to the DataView object that initiated the execution. Otherwise, the return value is null.

Parameters

None

Remarks

This method returns a reference to the DataView that initiated execution in response to an action menu item. When an item on the action menu is invoked, the DataView that owns the action menu is called the initiator of the action. Calling this method returns a reference to the initiator.

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

declare ScatterPlot scat;
scat = ScatterPlot.Create( dobj, "wind_mph", "min_pressure" );
scat.AppendActionMenuItem( "Print Variables",
    "run PrintVariables();" );

declare Histogram hist;
hist = Histogram.Create( dobj, "latitude" );
hist.AppendActionMenuItem( "Print Variables",
    "run PrintVariables();" );

run PrintVariables();

/* A single module that is called from the main program
   and from two different plots */
start PrintVariables();
    declare Plot plot;
    plot = DataView.GetInitiator();
    /* compare with Java null. Note double equal signs! */
    if plot == null then do;
        print "Module not called from Action Menu";
        return;
        end;

    plot.GetVars( ROLE_ANY, mVarNames );
    reset noname;
    print "The variables in this plot are" mVarNames;
finish;
/* Press F11 in each plot window and select the menu item. */
See Also

DataView.AppendActionMenuItem
DataView.IsEquivalent
DataView.IsInstance