Page 1 of 1

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

Posted: Wed May 16, 2018 1:15 am
by mamo
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