program variables of Addin can not be used outside

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 Moderator, EViews Gareth

program variables of Addin can not be used outside

Postby maxchen on Tue Aug 30, 2011 12:59 am

!doR2 is defined in the eqsumtab.prg of EqTabs Addin
Code: Select all
%ex7 = "\Example Files\EV7 Manual Data\"
%ch2 = "Chapter 2 - A Demonstration"
%wf = @evpath + %ex7 +%ch2 +"\demo.wf1"
pageload %wf
eqsumtab eq*   'save in table "results", and @getnextname

'rename {%tabname} tbeqs 'no effect
c(1) = !doR2   'error

also, %tabname is defined in eqsumtab.prg, but can not be used outside the Addin in the line "rename {%tabname} tbeqs"
maxchen
 
Posts: 103
Joined: Fri Oct 10, 2008 4:03 pm

Re: program variables of Addin can not be used outside

Postby EViews Gareth on Tue Aug 30, 2011 7:50 am

Yep.
Follow us on Twitter @IHSEViews
EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
 
Posts: 5781
Joined: Tue Sep 16, 2008 5:38 pm

Re: program variables of Addin can not be used outside

Postby maxchen on Tue Aug 30, 2011 6:44 pm

Thanks, but the object created in Addin is not local, say live in the workfile, and can be accessed by the main prg file.
maxchen
 
Posts: 103
Joined: Fri Oct 10, 2008 4:03 pm

Re: program variables of Addin can not be used outside

Postby EViews Gareth on Tue Aug 30, 2011 7:15 pm

Correct. Workfile objects belong to workfiles, program variables belong to programs. When you delete a workfile, all objects in that workfile are gone, even if you're still running the program that created them. When you exit a program, all program variables in it are also gone, but the workfile objects it created are left behind.
Follow us on Twitter @IHSEViews
EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
 
Posts: 5781
Joined: Tue Sep 16, 2008 5:38 pm


Return to Add-in Writing area

Who is online

Users browsing this forum: No registered users and 1 guest