How to use "_this"

For tips, questions and general information about writing Add-ins, how to package them, and how to submit them to EViews for publication.

Moderators: EViews Gareth, EViews Moderator

EViews Esther
EViews Developer
Posts: 149
Joined: Fri Sep 03, 2010 7:57 am

How to use "_this"

Postby EViews Esther » Wed Dec 01, 2010 2:32 pm

EViews 7.1 provides a new keyword _this which refers to the currently active object.

To illustrate the main idea, suppose that we have a series “x” which contains all ones:

Code: Select all

series x = 1

[E.g.1] _this can refer to the object that you lastly clicked on.
If you click on “x” in the workfile, _this denotes the “series” object.
Note that _this can be any object (such as coef, equation, group, etc.) you will choose in your workfile.

[E.g.2] When used in a program, _this refers to the active object at the time the program was initiated.
In particular, suppose we have the trivial (silly) program Myline.prg which consists of the command:

Code: Select all

_this.line

If you run this program, you will see the line for the series “x”.

Now, let us add the following lines (in Myline.prg):

Code: Select all

_this.line
series y = 2
_this.line

Do you see the line for the series “y”? No. :wink: We still see the line for the series “x” because _this refers to the initially opened object.

Return to “Add-in Writing area”

Who is online

Users browsing this forum: No registered users and 1 guest