Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

At 06 APR 2009 09:58:01AM Ralph Johler wrote:

I seem to recall that there is a simple method to determine that a program is running from a window.

We have a program, that is run from a symbolic and the symbolic is a prompt in a Window. When that program is run from the symbolic from the window, we need it to behave just a bit differently. Something like;

IF is_window THEN

  • Do special window thing

END ELSE

  • Do normal process

END

But I can't find that simple method.


At 06 APR 2009 10:10AM Victor Engel wrote:

I would probably use the RETSTACK function although I'm sure there are a number of other ways.


At 07 APR 2009 10:07AM Michael Slack wrote:

Hello:

I've used the system variable @MV (R\Basic manual, page 86) in symbolics to determine if it's being called from a window or from a LIST/SELECT statement or from a program.  This assumes that the symbolic is a multivalue and that it's being called from the window from a multivalue prompt.  If the cursor is on a multivalue prompt, then the @MV will hold the the line number / position number of the cursor within that prompt.  Otherwise it'll be zero (0).
Here is an example of how I've used it in a symbolic.

IF @MV THEN

VAR=@RECORD

END ELSE

LINE_COUNT=COUNT(@RECORD, @VM) + (@RECORD # '')
FOR I=1 TO LINE_COUNT
  VAR=@RECORD
NEXT I

END

@ANS=VAR

Another example would be:

IF @MV THEN

VAR=XLATE('tablename', @RECORD, 2, 'X')

END ELSE

VAR=XLATE('tablename', @RECORD, 2, 'X')

END

@ANS=VAR

I hope this helps.

Michael Slack


At 08 APR 2009 10:21AM Bob Carten wrote:

The old way was to see if @TUTOR=WINDOW", though that is not 100% reliable.

per this post

the most reliable way in Arev to tell if you are in a window is to look at the number of variables in the stack using a Stev-Smith utility called SSPEEK

the code looks like:

declare function SSPEEK

InWindow =(SSPEEK(1160)=135)

you can download the uitlity from Larry wilsons utilities site: http://arevweb.tripod.com/download.htm#SSPEEK

I have not tested this, just cut and paste from old posts.


At 12 APR 2009 08:55AM Eric wrote:

SS in SSPEEK stands for stack segment (referring to the AREV stack segment, not the register). I believe it was from Pat McNerthney - back on Compuserve.

So Steve doesn't get the credit this time.

There used to be a way to do this by declaring the AREV Windows common from (say) a symbolic or RBASIC program and then testing one of the variables to see if it was unassigned() - it's been so long I forget the details.

Steve Smith used not to discriminate between programs running in AREV Windows or outside them - his code was designed to fail equally well in both settings ;-)

Eric

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/ae7d74648f2bfc3585257590004cb919.txt
  • Last modified: 2023/12/28 07:39
  • by 127.0.0.1