Small trick for add-in documentation/help text to appear in _this.display

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

mamo
Posts: 189
Joined: Wed Nov 07, 2012 9:11 am

Small trick for add-in documentation/help text to appear in _this.display

Postby mamo » Wed May 16, 2018 1:15 am

Dear community,

this is just to share with you a minor trick to enhance the documentation of add-ins.

An add-in documentation text file can be made to appear in the own window of the object the add-in is registered to once the user provides a string such as "help" or just "?" as the first argument when calling the add-in from the command line, i.e., "myequation.myaddin ?". See program sniplet below.

Best, mamo

Code: Select all

' ... other parts of the addin programme

%addindoc=@addinspath+"\addindir\addinname.txt"  'path of the add-in documentation text file
%helpargs="help ?"  'one of these strings as first argument would trigger the display of the help text
%tmptxt=_$tmptxt      'name for the temportary text object

%arg1=@word(lower(@trim(%args)), 1)
if @wfind(%helpargs, arg1)  then
   text {%tmptxt}
   {%tmptxt}.append(file) %addindoc
   _this.display {%tmptxt}
   delete {%tmptxt}
   stop
endif   

' ... other parts of the addin programme

tvonbrasch
Posts: 540
Joined: Fri Apr 15, 2011 5:35 am

Re: Small trick for add-in documentation/help text to appear in _this.display

Postby tvonbrasch » Wed Nov 07, 2018 12:43 am

Great idea, really useful.


Here is an alternative way of opening an add-in documentation file. may be useful if the file is in pdf or another file format. it is assumed that the file is located in the same folder as the add-in:

Code: Select all

' ... other parts of the addin programme

   %about="addin_about.pdf"
   if @upper(%0)="HELP" or %0="?" then
      setmaxerrs 10
      %runpath=@runpath
      shell(t=3) {%runpath}\{%about}
      stop
   endif
   
' ... other parts of the addin programme    



Thomas


Return to “Add-in Writing area”

Who is online

Users browsing this forum: No registered users and 2 guests