Martin_Head wrote:
This is pretty much what I was trying outside of the program
to test OUTLN. This is pretty much what I was trying outside
of the program to test OUTLN.
First of all, did you try the code? It should be pretty self
explanatory in action. It simulates a popup menu: Display a
small menu. Disappear again on a key press. Sadly SMSQ/E only
has a very limited repertoire of PE commands, so without an
extra toolkit, such as QPTR or easyptr, you are restricted to
the cursor keys for movement and keystrokes for selection.
Line 110. I'm pretty sure I get an error with OUTLN
and no parameters on my main PC. But on the PC I am typing
this I don't (maybe something in my BOOT?).
There are different versions of OUTLN (not to be confused with
EasyPtr's OUTL) in various toolkits, so beware. The standard
SMSQ/E one used here must not have a channel number. If you
add a channel number you also have to open the channel and
specify the size and origin.
My documentation says that OUTLN without parameters
is 'OUTLN#0, smallest area which outlines all windows
currently open'.
I dont think this applies to SMSQ/E's OUTLN (see above)
So bearing in mind I am working on an old SuperBASIC
program running in a daughter SBASIC job. Should I have a
OUTLN#0,512,256,0,0 somewhere near the start of the program.
As #1 (the main drawing output window which I want to
preserve) gets resized to 512,256,0,0
Line 130. Do I only need to do an OUTLN for the channels
that will be 'pop up' windows, #2 and #3 in my case. and not
#1 the main drawing window. Also you have set an outline
smaller than the size of the default console
channel.
You can start an SBASIC daughter job without any open channels,
although any screen IO will always open at least one channel,
namely #0. (see
this topic for more)
Line 170. Why have you set the x and y size to 0? Is
that important?
Try it and see! This is what restores the background.
Line 180. Have you closed the channel just for
neatness? Or is it important to close the channel after
restoring the underlying window. I need to keep #2 and #3
open for further pop ups.
Obviously, I dont understand where youre at exactly. This was
just a simple demonstration of how to do a simple popup menu
without the use of further toolkits. Perhaps the following
development will make it more clear, so you can apply it to
your own circumstances.
Code: Select all
100 JOB_NAME 'Popup'
110 :
120 xorg% = 100: yorg% = 20
130 OUTLN 512, 256, xorg%, yorg%
140 PAPER 7: INK 0: CLS
150 :
160 k% = Popup(xorg% + 200, yorg% + 10, 'Hello World')
170 PRINT 'Keypress ='! k%
180 PAUSE
190 QUIT
200 :
210 DEFine FuNction Popup(xo%, yo%, txt$)
220 LOCal ch, k%
230 ch = FOPEN('con')
240 OUTLN#ch; 100, 100, xo%, yo%, 4, 4
250 CLS#ch
260 PRINT#ch; txt$
270 k% = CODE(INKEY$(#ch; -1))
280 OUTLN#ch; 0, 0, xo%, yo%
290 CLOSE#ch
300 RETurn k%
310 END DEFine Popup
320 :
As it stands, it assumes your screen is larger than 512x256.
If it isnt, you need to set xorg% and yorg% to 0. The
"program" also expects to be EXECuted, not RUN.
When does the area underneath the 'pop up' window get
saved?
When you set the outline.
In the above example what happens if the 'background' is
changed between the two OUTLN's. Say line 135 printed
something to #1 which is underneath the area covered by #ch.
When line 170 is reached, does the background get restored
correctly, or is it restored to the state it was in on line 130?
In the given example, no changes can take place in the
background because the program is busy displaying the menu

If you intend your popup menu to be external to the main
program, thats a different ballgame. Just experiment until you
get the effect you want!