DADiSP Worksheet Functions > Function Categories > Variables > REFWINDOW

 

REFWINDOW

Purpose:

Directly references a Window in an SPL function.

Syntax:

REFWINDOW(var)

var

-

A variable that contains a Window.

Returns:

A window.

Example:

setxrange(w)

{

    if (argc < 1)

    {

        // reference the current Window

        w = refwindow(W0);    

    }

 

    setx(w, 10, 20);

}

 

If the function setxrange is invoked without an input Window, the input defaults to the current Window. W0 refers to the current Window and the statement:

 

w = refwindow(W0)

 

sets variable w to the current Window. If the statement was:

 

 w = W0;

 

then variable w would be assigned a copy of the series in W0 instead of the window itself. Since SETX expects an optional Window, the statement:

 

 setx(w, 10, 20);

 

would fail.

 

Remarks:

As shown in the example, REFWINDOW is very useful for defaulting the input to an SPL function to the current Window.

 

REFWINDOW can be abbreviated as REFWIN.

 

See REFSERIES to reference a series in an SPL function without creating a copy.

 

See CASTWINDOW to convert a number or string into a Window.

See Also:

CASTWINDOW

CURRENT

END

REFSERIES

W0