home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Press 1997 July
/
Sezamfile97_1.iso
/
msdos
/
database
/
pdx_ti2.arj
/
TI1107.ASC
< prev
next >
Wrap
Text File
|
1992-08-17
|
8KB
|
331 lines
PRODUCT : Paradox NUMBER : 1107
VERSION : 4.0
OS : DOS
DATE : August 17, 1992 PAGE : 1/5
TITLE : Manipulating Window Frames in Paradox 4.0
Intended Audience:
This Technical Information sheet is intended for someone with a
moderate level of PAL 4.0 knowledge and an aptitude for
experimentation.
Prerequisites:
A basic understanding of Dynamic Arrays, Events, and the Paradox
4.0 user interface.
Purpose:
The purpose of this Technical Information sheet is to give
instructions for toggling a window frame on or off and a more
sophisticated technique which automatically removes the frame of
new windows as they are opened.
It is sometimes desirable to remove the window frame which is
placed around all Paradox objects. This removal of the frame
allows the user to see more of the object on the workspace
without scrolling. In addition the frame is less useful for
users who do not have or use a mouse. The first part of this
document explains how to use the SetKey command to use a hotkey
toggle which turns the frame on and off. The second part
demonstrates the use of a GetEvent loop which analyzes each
window as it is created and removes its frame automatically.
Part I
Changing a feature or "Attribute" of a window is usually done by
creating a dynamic array then assigning the attributes defined in
this array to a window.
The following is a statement which defines a dynamic array that
can turn off a frame:
DYNARRAY WinAttributes[]
WinAttributes["HASFRAME"] = False
So far this statement has done nothing more than declare the
existence of the Dynarray and assign/create a single tag equal to
the value False.
To actually modify a window with this tool you must use the
Window Setattributes command. This command sets attributes from
PRODUCT : Paradox NUMBER : 1107
VERSION : 4.0
OS : DOS
DATE : August 17, 1992 PAGE : 2/5
TITLE : Manipulating Window Frames in Paradox 4.0
a dynamic array to a specific window identifier called a
"handle". The following command turns off the frame for a window
whose handle is stored in a variable called "WinHandle":
WINDOW SETATTRIBUTES WinHandle FROM WinAttributes
Note: Many other options may be set using this technique. A
useful addition to the code above is the ability to Maximize a
window. You can do this by assigning the value True to the
"Maximized" tag.
The three lines of code discussed here could easily be placed
into a script file and played by using the SetKey command. The
following command would play a script called "NoFrame", which
contains the code listed above, by pressing the hotkey
combination Alt-F:
SETKEY -33 PLAY "NoFrame"
Here is the contents of NoFrame.Sc up to this point, including
the Maximized option:
DYNARRAY WinAttributes[]
WinAttributes["HasFrame"] = False
WinAttributes["Maximized"] = True
WINDOW SETATTRIBUTES WinHandle FROM WinAttributes
So far we have a script which always assures that the frame is
off and the window is maximized. If we wanted to make this a
true toggle, we would have to analyze the current window
attributes and switch the frame on or off depending on it's
current state. To read the attributes from use the Window
GetAttributes command. This command creates a dynamic array
which holds values for all of the possible window attributes.
You can use the PAL "Not" operator to switch the True or False
value to its opposite.
The following script gets the attributes from the current window
(using a PAL function called GETWINDOW()), toggles the frame
element of the dynamic array, sets the Maximized option to true
regardless of current setting, then sets the attributes on the
current window from the modified dynamic array:
PRODUCT : Paradox NUMBER : 1107
VERSION : 4.0
OS : DOS
DATE : August 17, 1992 PAGE : 3/5
TITLE : Manipulating Window Frames in Paradox 4.0
WINDOW GETATTRIBUTES GETWINDOW() TO WinAttributes
WinAttributes["HASFRAME"] = NOT WinAttributes["HasFrame"]
WinAttributes["MAXIMIZED"] = True
WINDOW SETATTRIBUTES GETWINDOW() FROM WinAttributes
You can remove the third line from the script if you do not want
to expand the window as well as toggle the frame.
Part II
A non-mouse user may wish to always run Paradox interactively
without frames on any windows created by Paradox. It is possible
to run a special loop which allows a user to have full access to
most features in the interactive program but also checks
constantly for new window creation. When a new window appears
the frame is removed.
A new handle is determined by comparing the last highest value to
the current window handle. Paradox assigns incremental numeric
values to handles as new windows are opened. The following
script does just this:
DYNARRAY NoFrame[]
NoFrame["HASFRAME"] = False
NewHandle = 0
HighHandle = 0
ECHO NORMAL
WHILE (True)
GETEVENT TO NewEvent
IF NewEvent["TYPE"] = "KEY" AND NewEvent["KEYCODE"] = 17 THEN
QUITLOOP
ENDIF
ENDIF
EXECEVENT NewEvent
NewHandle = GETWINDOW()
IF NewHandle > HighHandle THEN
WINDOW SETATTRIBUTES NewHandle FROM NoFrame
HighHandle = NewHandle
ENDIF
ENDWHILE
PRODUCT : Paradox NUMBER : 1107
VERSION : 4.0
OS : DOS
DATE : August 17, 1992 PAGE : 4/5
TITLE : Manipulating Window Frames in Paradox 4.0
Briefly, this script does the following:
o Declares a dynamic array called NoFrame with Frame
attribute off and Maximized option on.
o Initializes HighHandle and NewHandle variables.
o Uses Echo Normal to allow the user to see all activity on
the interactive workspace.
o Enters a While loop to recursively perform the processes
which follow.
o Gets the next Event (i.e. mouse action, key action, menu
choice, etc.).
o Checks to see if the key combination Ctrl-Q (ASCII code
17) has been pressed to exit the loop.
o Executes the event for Paradox processing.
o Assigns the window handle of the current window to the
variable NewHandle.
o If the value of NewHandle is higher than the previous high
handle (HighHandle), then turn the frame off on the new
window.
o Makes the new handle the highest handle for comparison to
subsequent window handles.
This process will continue until the user leaves Paradox or
presses Ctrl-Q.
Notes:
o The Scripts main menu selection will be different while
running under script control. If you want to write
scripts or do instant scripts, you must terminate the
GetEvent loop with Ctrl-Q.
PRODUCT : Paradox NUMBER : 1107
VERSION : 4.0
OS : DOS
DATE : August 17, 1992 PAGE : 5/5
TITLE : Manipulating Window Frames in Paradox 4.0
o This script may cause slow performance on machines with
low memory due to the constant code swapping that would be
necessary to process events.
o See your PAL Reference Guide for full explanations of the
PAL commands in the above scripts.
DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information
pertains.