Category : Pascal Source Code
Archive   : PWRWIN11.ZIP
Filename : DEMO1.PAS

 
Output of file : DEMO1.PAS contained in archive : PWRWIN11.ZIP
program demo;

{$r+}

{ This program demonstrates how to use the Power Windows routines.
Other than that, it does nothing useful. However, it is still

Copyright 1986,87, Options Unlimited Research Corp. }


{$i windec11.inc}
{ this is the file containing global declarations. It
must be included before the windowing routines }

var win1,win2,err,x,y: byte;
temps: windowstring;


{$i pwrwn111.inc}

{$i pwrwn112.inc}
{ these are the files containing the windowing routines.
They must be included before any calls in the main program
to anything related to windows }


begin


init_windows;
{ Initialize the windows, and set up housekeeping. This
is the first routine you must call, and it must be
called only once }

windowwrapon:=true; { text that starts in a window will wrap at edge
of window }

{ create a window from (8,8) to (60,15) on the screen,
with a border of asterisks. The window sits at (2,2)
on the vscreen. The vscreen has 80 columns and 25 rows.
It is initially all spaces, and the frame has a title
of 'win1'. From now on, this window will be referred to
as win1 }


create_screen(8,8,60,15,2,2,80,25,ord('*'),ord(' '),'win1',win1,err);

if err <> 0 { check for errors }
then writeln('err=',err);

open_window(win1,err); { open win1 }

if err <> 0
then writeln('err=',err);

{ write some text at window location (40,1) }
write_window_at_xy(win1,40,1,'This is very long text being written. '+
'Notice how it wraps around.',err);

delay(1000); { pause for effect }

close_window(win1,err); { and close win1 }



create_screen(7,7,22,22,5,5,40,20,1,ord(' '),'window 2',win2,err);
{create another window, called win2}

if err <> 0
then writeln('err=',err);

open_window(win2,err); { open win2 }

if err <> 0
then writeln('err=',err);

write_screen_at_xy(win2,35,1,'writing in win2',err);
{ write to win2, outside window.
Notice how screen wrap causes
end of sentence to be written
in window. This also happens
because the vscreen window
location changes to make sure
that the physical cursor,
which follows the screen cursor,
is really on the physical screen }

write_window(win1,' This was written while window 1 was closed.',err);

write_window(win2,' About to make window 1 active',err); { a hint of what's to
come }

delay(1000);

make_active(win1,err); { bring win1 back. Note the text is all there }

delay(1000);

make_active(win2,err); { win2 was already open, but now it covers win1 }

delay(1000);

make_active(win1,err); { and now win1 covers win2 }

delay(1000);

if err <> 0
then writeln('err=',err); { check for errors }

{ move win1 cursor up 2 and 3 to the left }
move_cursor_window(win1,cursors[win1,1]-3,cursors[win1,2]-2,err);

clear_window_eol(win1,err); { clear the rest of the line }

delay(1000);

{ read some text from the window }
temps:=read_window_at_xy(win1,4,2,err);

write_window_at_xy(win1,5,7,'The word "'+temps+'" was read',err);

delay(1000);

move_window_physscreen(win1,5,5,err); {move win1 to 5,5 on the physical screen}

delay(1000);

frame(win1,2,err); { change win1 border to a double line }

refresh_screen; { show everything as it's known inrernally.
This amounts to displaying the new frame }



dispose_screen(win2,err); { get rid of win2 }

if err <> 0
then writeln('err from dispose screen=',err);


create_screen(7,7,22,22,1,1,16,16,1,ord(' '),'',win2,err);
{ create a new win2 }

if err <> 0
then writeln('err from create=',err);


open_window(win2,err);

if err <> 0
then writeln('err from open=',err);

move_cursor_window(win2,5,8,err);

{ put a lot of text there, to demonstate scrolling }
write_window(win2,'This is to see how much will be printed in one window.',
err);
write_window(win2,' I will just keep on writing things until it either',err);
write_window(win2,' scrolls around or does something else, I''m not sure',err);
write_window(win2,' what, but I guess we soon shall see. The trick is',err);
write_window(win2,' something long enough to get to the bottom. ',err);


(* try this if you have an PC or compatible with CGA:

hires; { graphics mode }

{ let it know the physical screen was cleared }
for x:=1 to maxcolsinphysscreen do
for y:=1 to maxrowsinphysscreen do physicalscreen^[x,y]:=ord(' ');

refresh_screen; *)

end.


  3 Responses to “Category : Pascal Source Code
Archive   : PWRWIN11.ZIP
Filename : DEMO1.PAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/