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 thingEND ELSE
Do normal processEND
But I can't find that simple method.
I would probably use the RETSTACK function although I'm sure there are a number of other ways.
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=@RECORDEND ELSE
LINE_COUNT=COUNT(@RECORD, @VM) + (@RECORD # '')FOR I=1 TO LINE_COUNTVAR=@RECORDNEXT IEND
@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
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.
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