03.06.2013 Views

Turbo Prolog

Turbo Prolog

Turbo Prolog

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

makewindow( ... )<br />

shiftwindow( ... )<br />

removewindow( ... )<br />

clearwindow( ... )<br />

window_str( ... )<br />

window_attr( ... )<br />

Also useful in this connection is the cursor positioning standard predicate<br />

cursor( ... )<br />

We'll now consider each predicate, starting with makewindow.<br />

makewindow(WNo,ScrAttr,FrameAttr,Header,Row,Col,Height,Width)<br />

The predicate makewindaw defines an area of the screen as a window. All parameters<br />

except Header must be integers. Header must be a string or symbol, and it is used as a<br />

title in the upper frame line. Windows are identified by a number (WNa) which is used<br />

to select which on-screen window is active. If FromeAttr is greater or less than zero, a<br />

border is drawn around the defined area (i.e., the window is framed) in the color<br />

specified by that attribute. Once defined, the window is "cleared" to the background<br />

color and the cursor is moved to its topmost left corner.<br />

The row and column positions of the top left corner of the window-relative to the<br />

whole screen-are specified by parameters Raw and Cal respectively, and Height and<br />

Width give the dimensions of the window. Raw, Cal, Height and Width should correspond<br />

to the size of the display. Typically, display size is 25 rows of 80 characters, but<br />

this can be changed with the graphics standard predicate (see Chapter 8). Here's an<br />

example use of makewindaw:<br />

makewindow(1,7,135,IIMy first window ll ,1,20,L;,3L;)<br />

Here, makewindaw specifies window number I, with a black and white display. A border<br />

will be drawn (FromeAttr is 135) with the header "My first window" and the window<br />

itself will be 4 rows high, 34 columns wide and be positioned with the top left<br />

corner at row I, column 20 of the screen (note that rows and columns are numbered<br />

from 0 onwards).<br />

On the other hand<br />

makewindow(2,7,135,lIcount the rows ll ,8,20,19,3L;)<br />

will result in the error message<br />

the parameters in makewindow are illegal<br />

since a window with height 19 is impossible if positioned starting from row 8 (8+ 19 ><br />

25 I). Notice also that if Height and Width are bound to 10 and 20 respectively, the<br />

actual display area of the window will be 8 rows and 18 columns if the window is<br />

framed (i.e., FromeAttr is bound to a non-zero value), since the frame will then occupy a<br />

total of two rows and two columns.<br />

Tutorial V: Seeing Through <strong>Turbo</strong> <strong>Prolog</strong>'s Windows 79

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!