PWoutln: SETTING THE OUTLINE IN THE INTERPRETER

This Chapter explains what PWoutln does.

Purpose

With PWoutln, you set the outline of a window. In an ideal world, this keyword shouldn't be necessary since, normally, the outline of the window is set automatically by ProWesS whenever you activate an outline object. The keyword is necessary, however, when you use the SBasic interpreter.

You may remember that the introduction mentioned that ProWesS is a window manager, and still needs the Pointer Interface. The latter is responsible to let programs know that the pointer is in their window. To be able to do this, however, the Pointer Interface itself has to be truely aware of the window: it has to know a certain number of things about the window.

Setting the outline of a window tells the Pointer Interface these things about the window. Now, normally, this is done by the PWactivate keyword. However, one peculiarity of the Pointer Interface is that the outline of the very first window of a program must always be set in this manner - if it isn't, setting the outline of other windows in the program won't work correctly.

This is no problem when your program is compiled (with the 'WINDS' option turned OFF - see the chapter on compilation) or if you EXEC'ed an SBasic program so that it has no windows open at the start. In the interpreter however, windows#0, 1 and 2 are already open before you RUN your program - and the outline of window#0 is not set! So, the PWoutln keyword is used to set the outline of window#0 (the first one to be opened for the interpreter) of the SBasic you're working in. After that, everything will work alright.

You can test this by using the test examples supplied here. REM out the part setting the outline of channel#0 and run the program. You will note that the windows are still drawn (more or less) correctly, but you cannot get the mouse to work... In other words, the Pointer Interface doesn't tell your program correctly that the pointer is in the window, so you must use PWoutln. Also, the PWscrsize keyword tells you the maximum size a window (i.e. window #0) can take.

Syntax

The syntax of this keyword is as follows:

PWoutln [#chan%],x_size%,y_size%,x_orig%,y_orig%

Please note that after you have used this command, you will have to redefine the windows for the job (i.e. channels #0 ,#1 and #2). The example programs use a procedure called "set_windows" just for that.

Example

The following example sets the outline of channel#0 so that it covers the whole screen, but leaves enough space at the top for two rows of buttons. To do this, it first gets the maximum size of window #0:

   
         xs%=0:ys%=0:xo%=0yo%=0
         PWscrsize#0, xs%,ys%,xo%,yo%
         PWoutln #0,xs%,ys%-28,xo%,yo%+28

PROGS, Professional & Graphical Software
last edited 1996 Aug 06 (wl)