home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_PAS
/
WINDOB10.ZIP
/
WINDOBJS.DOC
< prev
next >
Wrap
Text File
|
1994-03-19
|
7KB
|
193 lines
| Windobjs Documentation
| Version 1.0
| Copyright 1994, Jake Geller
Description :
Windobjs is a unit dedicated to graphical windows. It is easy to use and
offers great flexibility (In my humble opinion). Some features include
moveable windows, sizeable windows, closeable windows, and controls within
windows (that are limited to the window). The windows only redraw where they
need to redraw (through viewports!) so they are as fast as you can go with the
BGI. Perhaps, in the future, I will remove the BGI and write my own graphics
routines.
BIG NOTE :
As you can see, this documentation is rather obtuse. I'm a programmer,
not a document writer, and I wanted to get this out into the public quickly,
so I haven't spent a great deal of time writing these. If you have questions
regarding this programming unit, or suggestions, or just plain complaints,
please Email me at :
Bgeller@moose.uvm.edu
Or mail me at :
Jake Geller
RR 1 Box 1376
Charlotte, VT 05445
Also, this unit is shareware. You may use it for personal use as long as
you would like, but any commercial use (ie., you get money for a product which
incorporates this unit) must be registered. Registration costs a measly $15
and entitles the user to complete source code for up to 2 more verions.
Disclaimer :
The author, me, does not insure any of this program or what it does. If
your computer is fried because of this program, I'll be very surprised, but
tough. (There are no viruses in this object, you can run whatever virus
checker's you want on it to verify that)
Using Windobjs in your program :
The first step to creating a WindObjs program is to create a new main
application. Turbovision uses "TApplication," I use "PMain"... Creating a new
application is easy :
Program BareMinimum;
var
Main : PMain; {Main Application for insertion}
begin
New(Main, Init);
Main^.Done;
end.
What does the above program do? Well, nothing, actually, but you probably
expected that. It _does_ enter graphics mode and change the background color
to 7, it initializes variables for the application that need to be
intialized, and it initializes the mouse. Then it returns you to textmode.
The next step is to add some windows. Windows are objects, too, and they
have to be "Insert"ed in to the application so that the application will know
they're there. Then the application has to be run to handle events for
windows.
Program Lets_Add_A_Window;
var
Main : PMain;
Window : PView; {Here's our new window!}
Begin
New(Main, Init);
New(Window, Init(10,10,100,50,'Demo Window',TheFlags);
Main^.insert(Window);
Main^.Run;
Main^.Done;
end.
A couple of new things here. One is, we added a window. The window is
located at coordinates (10,10) and is 100 pixels wide and 50 pixels high.
Its title is "Demo Window" and it has the default flags. TheFlags is a
variable of type ByteSet which is a set of flags cmSize, cmMove, cmClose,
cmMax. TheFlags starts out as having all of these flags set. Or you can put
in that area "cmSize+cmMax" to have it sizeable and maximizable. The
"Main^.Insert(Window)" inserts the window in to Main's list of objects. It
then checks for the mouse and handles any buttonpresses.
Okay, so we can put in a window or two. That's not going to help the
application look its best. So we add controls. Controls have to be
"init"ialized and "insert"ed just like windows. They can be inserted either
in to the application or a view. If they're inserted in to the view, their
coordinates are relative to the view's. Here's an example of adding a
"Button" control.
Program Lets_Add_A_Window;
var
Main : PMain;
Window : PView;
Button : PButton; {Here's a button!}
Begin
New(Main, Init);
New(Window, Init(10,10,100,50,'Demo Window',TheFlags);
New(Button, Init(5,5,150,15,'Button',donothing));
Window^.Insert(Button);
Main^.insert(Window);
Main^.Run;
Main^.Done;
end.
This adds a button named "Button" to the window "Window." The button is
labeled "Button" (centered in the button) and when you press it, the procedure
"donothing" is run. Donothing is a built in procedure, so if you want your
button (or other control) to do absolutely nothing, put "donothing." The button
is at relative coordinates (5,5) and is 150 pixels wide and 15 pixels high.
What does that mean on the screen? It means that there is a window at (10,10)
and at coordinates (15,35) there is the upper lefthand corner of a push
button. Why 35? Why not 15? Because there is a header on each window that
is 20 pixels high.
Another type of control is a "PIcon" which, as it looks, is an Icon control.
The icon control has the same "init" except that there is an extra parameter
at the beginning called "Filename"... Filename is the name of the iconfile.
An iconfile consists of a BitMaped image (gotten with GetImage) blockwritten
to a file. Icons have to inserted just like Buttons. Unlike buttons, icons
can be moved around within the view (they are restricted to the view or
application boundaries, however). Icons, once they are pressed, if they
aren't moved at all, invert. The colors become reverse of what they were. If
you press the icon again without moving, whatever their procedure is will be
executed.
The procedures that are run by controls must be declared as FAR:
Procedure ButtonWasPressed; far;
or an error will be generated and the program will halt.
Appendix A : Objects
PButton
PCheckBox
PIcon
PMain
PText
PView
PButton - Control
PButton.Init(X1, Y1, Width, Height: Integer; Text : String; Proc2Do :
Procedure);
PButton adds a push button to a window or the main application.
PCheckBox - Control
PCheckBox.Init(X, Y, Width, Height : Integer; Text : String);
Adds a checkbox to your document. Can be "read" with the "SELECTED"
attribute.
PIcon - Control
PIcon.Init(FileName : String; X1, Y1, Width, Height: Integer; Text :
String; Proc2Do : Procedure);
PIcon adds a moveable icon to a window or the main application.
PMain - Application
PMain.Init();
Creates an application. Necessary for Windows execution!!!!!!!
PScrollBar - Control
PScrollBar.Init(X1, Y1, Width, Height : Integer);
PIcon adds a scrollbar to a view.
PText - Control
PText.Init(X1, Y1, Width, Height : Integer; Text : String; Proced :
Procedure);
Adds a static text box to a view or the main application.
PView - View
PView.Init(X1, Y1, Width, Height : Integer; Title : String; Flags :
FlagType);
Adds a new window to the application.