home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
genapps
/
hp22dc.arj
/
REFGUIDE
/
MESSAGES.TXT
< prev
next >
Wrap
Text File
|
1991-05-16
|
44KB
|
1,320 lines
_______________________________________________________________________
Chapter 1: What's Really Happening 73
________________________________________________________________________
CHAPTER TEN: MESSAGES
The following chapter describes in detail all of the messages sent to
HyperPAD's objects. It is divided into three sections, one for each type
of object that can initially receive a message. Each section begins with
a table describing the messages discussed in that section. At the end of
this chapter is a table of common events that occur in HyperPAD, along
with the list of messages sent when these events occur.
ABOUT MESSAGES
A message is a notification sent to an object indicating that something
has happened in the HyperPAD system. For example, if you click the mouse
on a button, the mouseUp message is sent to that button.
Once sent, a message follows a predetermined path through the object
hierarchy. The starting point into this path is either a button, field,
or page.
If the receiving object does not have a handler for a message, the
message will be passed on to the next object in the hierarchy until
either a handler is found for that message or it reaches HyperPAD.
There are two types of messages that can be sent to objects. The first
type is a notification message. This type of message is sent after an
action has already occurred, and thus notifies the object of the event.
The second type of message is sent before an action occurs. For example,
when the user selects the Delete Button command from the Edit menu, the
deleteButton message is sent to the current button. The button will not
be deleted until the message has traveled through the object hierarchy
and is received by HyperPAD.
_______________________________________________________________________
Chapter 1: What's Really Happening 74
________________________________________________________________________
MESSAGE SENT FROM COMMANDS
In addition to the messages sent to objects, there are a few messages
automatically sent by their command counterparts. You can create
handlers for them. The implementation for these messages is defined in
HyperPAD itself.
beep
close
flushCache
fxshow
noSound
play
playBack
record
setDefaultPopupColors
setPopupColors
sound
wait
You can find descriptions of these commands in Chapter Eleven,
"Commands."
MESSAGES SENT TO A BUTTON
This section lists all of the messages that are initially sent to
buttons. In other words, a button is a possible entry point into the
object hierarchy for these messages. If the receiving button does not
contain a handler for the message, the message will be passed up the
hierarchy until it reaches a handler for that message. If no handler is
found, the message will eventually reach HyperPAD.
The following table shows all of the messages sent to buttons. The
column on the right indicates if the message is sent before or after the
action occurs (i.e. results in an action when received by HyperPAD).
Message: Message Type:
---------------------------------------------------
closeButton after
deleteButton before
keyPress before
mouseDown after
mouseEnter after
mouseLeave after
_______________________________________________________________________
Chapter 1: What's Really Happening 75
________________________________________________________________________
Message: Message Type:
---------------------------------------------------
mouseStillDown after
mouseUp after
mouseWithin after
newButton after
openButton after
select after, except with checkBox buttons
-----------------------------------
CLOSEBUTTON
This message is sent to a button when the focus is removed. A button
loses the focus when the user moves the cursor by clicking the right
mouse button outside the button's borders, or by pressing the TAB key or
arrow keys to move to another object.
The following example uses closeButton and openButton to change the
border of a button, indicating when the button has the focus.
handler closeButton;
begin;
set the edgeType of me to 1;
end;
handler openButton;
begin
set the edgeType of me to 2;
end;
-----------------------------------
DELETEBUTTON
The deleteButton message is sent to a button when the user selects Cut
Button or Delete Button from HyperPAD's menus. When this message reaches
HyperPAD, the button is deleted. By intercepting the message, you can
prevent buttons from being deleted.
_______________________________________________________________________
Chapter 1: What's Really Happening 76
________________________________________________________________________
For example, the following handler (in a button script) presents the
user with a dialog box whenever Delete or Cut Button is selected, asking
them if it is okay to delete the button.
handler deleteButton;
begin
answer "Ok to delete button?" with "Yes", "No";
if it is "Yes" then pass;
end;
This example passes the message on to HyperPAD (to delete the button)
only if the user answers "Yes" in the answer dialog box.
-----------------------------------
KEYPRESS
The keyPress message is sent to the button with the focus when any key
is pressed.
In the following example, pressing CTRL+ENTER selects the button:
handler keyPress(k);
begin
if key(k) is "CTRL+ENTER" then send "select" to me
else pass;
end;
-----------------------------------
MOUSEDOWN
The mouseDown message is sent to the button when the mouse button is
pressed while the mouse pointer is within the rectangle of the button.
-----------------------------------
MOUSEENTER
The mouseEnter message is sent to the button when the mouse pointer
enters the button's borders. The mouse button does not have to be
pressed for this message to be sent. (See the example under mouseLeave.)
-----------------------------------
MOUSELEAVE
The mouseLeave message is sent to the button when the mouse pointer
exits the button's borders. This message will only be sent to objects
that have first received a mouseEnter message.
An interesting use for mouseEnter and mouseLeave is to highlight the
button that the mouse pointer is currently on.
_______________________________________________________________________
Chapter 1: What's Really Happening 77
________________________________________________________________________
The following handlers in the button script will accomplish this:
handler mouseEnter;
begin
set the hilite of me to true;
end;
handler mouseLeave;
begin
set the hilite of me to false;
end;
-----------------------------------
MOUSESTILLDOWN
The mouseStillDown message is sent to a button continuously while the
mouse button is held down. In order for this message to be sent, the
mouse must have been initially pressed within the rectangle of the
button.
-----------------------------------
MOUSEUP
The mouseUp message is sent to a button when the mouse button is
released and the mouse pointer is within the button's border. The mouse
pointer must be inside the original button where the mouse button was
pressed.
-----------------------------------
MOUSEWITHIN
When the pointer is within the button's rectangle, the mouseWithin
message is sent continuously. This message is sent after the initial
mouseEnter message.
-----------------------------------
NEWBUTTON
This message is sent to a button when it is created, just after it
appears on-screen. Usually, this message gets passed through the button
up the object hierarchy unless the button is being pasted and has a
script with a newButton handler.
The following example handler in the pad script of your Home pad causes
all new buttons to be colored red and have a double border:
handler newButton;
begin
set the edgeType of the target to 2;
set the color of the target to red;
end;
_______________________________________________________________________
Chapter 1: What's Really Happening 78
________________________________________________________________________
-----------------------------------
OPENBUTTON
This message is sent to a button when it receives the focus (is
highlighted). A button receives the focus when the user presses TAB or
the arrow keys to access it, or clicks a mouse button while the cursor
is inside the button's border.
The following example handler in a button script causes the button to
have a double border when it has the focus:
handler openButton;
begin
set the edgeType of me to 2;
end;
-----------------------------------
SELECT
This message is sent to the button with the focus if you press ENTER,
SPACE, or click the left mouse button while the cursor is inside the
button's borders. In other words, this message is sent to a button when
it is selected. Rather than using mouseUp handlers, create select
handlers to perform actions when buttons are selected since not every
HyperPAD user will use the mouse to select buttons.
Below is an example of a button script that uses the select handler:
handler select;
begin
go to the next page;
end;
The select message has special meaning for check box buttons. When the
user toggles the check of the button (by pressing ENTER or clicking the
button with the mouse), the select message is sent to that button. When
the message is received by HyperPAD, the check of the button is toggled.
By intercepting the select message, you can customize the behavior of
check box buttons. For example, the following handler in the button
script prevents the button's check mark from being changed because the
message is not passed on to the next object in the hierarchy.
handler Select;
begin
end;
_______________________________________________________________________
Chapter 1: What's Really Happening 79
________________________________________________________________________
The next example toggles the message box on and off in coordination with
the check mark of the button:
handler select;
begin
set the visible of msg to not the check of me;
pass;
end;
MESSAGES SENT TO FIELDS
The following messages are initially sent to fields. If the receiving
field does not contain a handler for the message, the message will be
passed up the hierarchy until it reaches an appropriate handler. If no
handler is found, the message will eventually reach HyperPAD.
The column on the right indicates if the message is sent before or after
the action occurs (i.e. results in an action when received by HyperPAD).
These messages are sent to fields:
Message: Message Type:
---------------------------------------------------
closeField after
deleteField before
keyPress before
mark before (for list box fields only)
mouseDown after
mouseEnter after
mouseLeave after
mouseStillDown after
mouseUp after
mouseWithin after
newField after
openField after
select after
unmark before (for list box fields only)
_______________________________________________________________________
Chapter 1: What's Really Happening 80
________________________________________________________________________
-----------------------------------
CLOSEFIELD
This message is sent to an unlocked field (one that can be edited) when
the focus is taken away. The focus is removed from a field when it is
exited by using TAB, the arrow keys, or the mouse. The focus may also be
changed from within a script.
The following example uppercases the contents of a field when the focus
is taken away:
handler closeField;
begin
put upper(the value of me) into me;
end;
See Also: openField
-----------------------------------
DELETEFIELD
The deleteField message is sent when the user selects Cut Field or
Delete Field from the Edit menu. By intercepting this message, you can
prevent fields from being deleted.
The following handler in a field's script checks to make sure it is okay
to delete the field.
handler deleteField;
begin
answer "Ok to delete field" && the name of me;
if it is "Ok" then pass;
end;
-----------------------------------
KEYPRESS
The keyPress message is sent to the field with the focus when a key is
pressed. By intercepting this message, you prevent keys from reaching
the field or HyperPAD. For example, you can create a field that does not
allow numbers, as in the following handler:
handler keyPress(keyNum);
begin
get key(keyNum);
if it is not in "1234567890" then pass;
end;
See Appendix 2, "Key Codes," for details on keyPress key values.
_______________________________________________________________________
Chapter 1: What's Really Happening 81
________________________________________________________________________
-----------------------------------
MARK
The mark message is sent to list box fields when the user attempts to
mark a line by pressing SPACE or the right mouse button. You can prevent
lines from being marked by intercepting this message and not passing it.
The line number being marked is passed as a parameter with this message.
As an example, the following handler keeps track of how many lines are
marked, allowing a maximum of ten:
handler mark(lineNumber);
begin
global numMarked;
if numMarked < 10 then
begin
add 1 to numMarked;
pass;
end;
end;
handler unmark(lineNumber);
begin
global numMarked;
subtract 1 from numMarked;
pass;
end;
Note: See the section on fields in the User's Guide for more
information on list box fields.
See Also: markerChar, unmark, markerAttr
-----------------------------------
MOUSEDOWN
The mouseDown message is sent to locked fields (fields that can not be
edited) when the user presses the left mouse button while the mouse
pointer is within the field's borders.
-----------------------------------
MOUSEENTER
This message is sent to a field when the mouse pointer is within the
rectangle of a field.
_______________________________________________________________________
Chapter 1: What's Really Happening 82
________________________________________________________________________
-----------------------------------
MOUSELEAVE
This message is sent when the mouse pointer exits the boundaries of a
field.
-----------------------------------
MOUSESTILLDOWN
The mouseStillDown message is sent to a locked field (uneditable field)
while the left mouse button is held down. This message will only be sent
if the mouse was initially pressed within the rectangle of the field.
-----------------------------------
MOUSEUP
The mouseUp message is sent to a locked field (uneditable field) when
the left mouse button is released and the mouse pointer is within the
field's borders. The mouse pointer must be within the same field that
received the initial mouseDown message.
If you click the mouse on an unlocked text field, the field will be
given the focus and opened for editing.
-----------------------------------
MOUSEWITHIN
The mouseWithin message is sent to a field continuously while the mouse
pointer is within the rectangle of the field.
-----------------------------------
NEWFIELD
The newField message is sent to a field when it is created, just after
it appears on-screen. Usually, this message gets passed up the object
hierarchy unless the field is being pasted and has a script with a
newField handler.
This handler, which causes all new fields to look like typical database
fields with the name appearing on the left, belongs in the pad script:
handler newField;
begin
set the showName of the target to true;
set the withEdge of the target to false;
set the rect of the target to 10,10,30,10;
set the hiliteIfFocus of the target to true;
end;
_______________________________________________________________________
Chapter 1: What's Really Happening 83
________________________________________________________________________
-----------------------------------
OPENFIELD
The openField message is sent to an unlocked field (one that can be
edited) when it receives the focus (opened for editing). A field
receives the focus when it is entered using TAB, the arrow keys, or the
mouse. The focus may also be sent to that field from a script or the
message box.
The following example keeps track of the last time a field was updated:
handler openField;
begin
global previous_content;
put the value of me into previous_content;
end;
handler closeField;
begin
global previous_content;
if previous_content is not the value of me then
put date() into field "last updated";
end;
-----------------------------------
SELECT
This message is sent to list box fields when the user presses ENTER or
double clicks the mouse on a line in the field, and it is sent to locked
fields when the user releases the mouse button. Use this message to
perform actions when the user selects an item from a list box. For
example:
handler select;
begin
get the currentLine of me;
get line it of the value of me;
ask "You have selected" && it;
end;
_______________________________________________________________________
Chapter 1: What's Really Happening 84
________________________________________________________________________
-----------------------------------
UNMARK
This message is sent to list box fields when the user attempts to unmark
a line by pressing SPACE or the right mouse button. Prevent lines from
being unmarked by intercepting this message and not passing it.
The line being unmarked is passed as a parameter.
Examples:
The following unmark handler prevents the user from unmarking all the
even lines (if they are marked).
handler unMark(lineNum);
begin
if lineNum mod 2 is not zero then pass;
end;
Note: See the section on fields in the User's Guide for more
information on list box fields.
See Also: mark, markerChar, markerAttr
_______________________________________________________________________
Chapter 1: What's Really Happening 85
________________________________________________________________________
MESSAGES SENT TO A PAGE
This section describes messages received directly by the page. If the
receiving page does not contain a handler for the message, the message
will be passed up the hierarchy to the background and so on until it
reaches an appropriate handler. If no handler is found, the message will
eventually reach HyperPAD.
The following table lists all of the messages and indicates if the
message is sent before or after an action occurs(i.e. results in an
action when received by HyperPAD).
Message: Type: Message: Type:
-----------------------------------------------------------------------
break after mouseStillDown after
cancel after mouseUp after
closePad after newBackground after
closePage after newPad after
deleteBackground before newPage after
deletePad before openPad after
doMenu before quit before
help before resume after
idle after startUp after
keyPress before suspend before
mouseDown after
-----------------------------------
BREAK
This message is sent to the current page when the user presses
CTRL+BREAK.
The combination CTRL+BREAK stops the execution of any pending handlers.
CTRL+BREAK also stops many other processes, including sort, query,
print, find, import, and export. A break handler can be useful if you
need to perform any cleanup when one of these tasks is interrupted.
_______________________________________________________________________
Chapter 1: What's Really Happening 86
________________________________________________________________________
For example, the following break handler cleans up if a find command was
interrupted.
This handler belongs in a button script:
handler select;
begin
global inFind;
ask "Find what?";
if it is empty then exit;
put true into inFind;
find it;
put false into inFind;
end;
This handler belongs in the page script:
handler break;
begin
global inFind;
if inFind then answer "Find aborted!" with "Ok";
end;
Comments: Another way to stop the execution of all pending handlers is
with the exit command:
exit to hyperpad;
See Also: keyPress
-----------------------------------
CANCEL
The cancel message is sent to the current page when the ESC key is
pressed. This is used to maintain compatibility with the HyperPAD User
Interface in which ESC takes you back.
The following example goes Home when the user presses ESC:
handler cancel;
begin
go home;
end;
-----------------------------------
CLOSEPAD
The closePad message is sent to the current page before the pad is
closed and disappears. This can happen when the user quits, changes to
another pad, or runs another program.
_______________________________________________________________________
Chapter 1: What's Really Happening 87
________________________________________________________________________
You can use closePad to perform any pad cleanup that may be necessary
before you leave a pad. The following handler uses that opportunity to
delete the contents of some fields:
handler closePad;
begin
put empty into field "time";
put empty into field "status";
end;
See Also: openPad, openPage, closePage
-----------------------------------
CLOSEPAGE
The closePage message is sent to the current page when you go to another
page, go to another pad, run another program, or quit HyperPAD.
The following example uses a closePage handler to hide some buttons.
Next time this page is accessed, the buttons will not be visible:
handler closePage;
begin
set the lockScreen to true;
hide button id 6;
hide button "Quit";
end;
See Also: closePad, openPage
-----------------------------------
DELETEBACKGROUND
The deleteBackground message is sent to the current page right before a
background is deleted. You can only delete a background after all the
pages using it are deleted or cut.
By intercepting this message, you control whether a background is
deleted. The following example allows a background to be deleted only if
the user's name is "John":
handler deleteBackground;
begin
ask "What is your name?";
if it is "John" then pass;
end;
_______________________________________________________________________
Chapter 1: What's Really Happening 88
________________________________________________________________________
-----------------------------------
DELETEPAD
This message is sent to the current page when the user selects Delete
Pad from the File menu. Since this message is sent before the pad is
deleted you can prevent deletion by intercepting this message.
The following example makes a backup of the current pad (with the same
name as the current pad, but with a DEL file extension) before it is
deleted:
handler deletePad;
begin
get the name of pad;
put ".DEL" after it;
record it & "{enter}";
playback;
doMenu "Save a Copy...";
pass;
end;
-----------------------------------
DELETEPAGE
The deletePage message is sent to a page when the user selects Delete or
Cut Page from the Edit menu. This message is sent before the page is
actually deleted. The page will only be deleted if this message is
received by HyperPAD. By intercepting deletePage, you prevent the page
from being deleted.
The following handler intercepts deletePage to make sure that a linked
page gets deleted too. It first saves the current page, then gets a
linked page number from a field called "Attached Page Number". It then
goes to that page and deletes it.
handler deletePage;
begin
get field "Attached Page Number";
push this page;
go to page "linked";
send "doMenu" "Delete Page" to this page;
pop page;
pass;
end;
_______________________________________________________________________
Chapter 1: What's Really Happening 89
________________________________________________________________________
The following handler intercepts deletePage to first make a copy of the
page in another pad called "backup":
handler deletePage;
begin
doMenu "Copy Page";
push this page;
go to pad "backup";
doMenu "Paste Page";
pop page;
pass;
end;
See Also: deletePad, deleteBackground
-----------------------------------
DOMENU
The doMenu message is sent to the current page when the user selects a
command from a menu. The exact text of the menu choice is sent with the
message as a parameter. Intercepting doMenu is a powerful way to
customize HyperPAD. You can redefine the actions taken when a user
selects commands from the menu.
The following example shows how to redefine the File Exit command. All
other menu commands will work normally.
handler doMenu(command);
begin
if command is "Exit" then beep
else pass;
end;
You can also select menu commands artificially, as is done in the
following handler in a button script:
handler select;
begin
doMenu "Printer Setup...";
doMenu "Page Setup...";
doMenu "Print...";
end;
Note: The menu command must be represented exactly as it appears on
HyperPAD's menu.
_______________________________________________________________________
Chapter 1: What's Really Happening 90
________________________________________________________________________
-----------------------------------
HELP
The help message is sent to the current page when the user presses F1 or
selects Help from the Go menu. By intercepting this message, you can
create your own help for your pads. If this message reaches HyperPAD,
HyperPAD's Help system will be loaded.
In the following example, the user is asked which help is preferred, the
local (yours) or the main HyperPAD Help system:
handler help;
begin
answer "Which help?" with "Local", "HyperPAD";
if it is "Local" then go to page "Local Help"
else pass;
end;
You can send the help message from within a script in order to go to
HyperPAD's help:
handler select;
begin
help;
end;
-----------------------------------
IDLE
This message is sent to the current page continuously when HyperPAD has
no other messages to pass and no other scripts are currently executing.
This message is only sent when the Browse tool is in use. Be cautious
when creating idle handlers. Since the idle message is sent so
frequently, the script will execute many times, greatly slowing down the
overall performance of your pad.
A good use of the idle message is to display the time in a field. The
following handler in the pad script will do so (make sure you create a
background field named "time" before trying this):
handler idle;
begin
put the time into field "time";
end;
_______________________________________________________________________
Chapter 1: What's Really Happening 91
________________________________________________________________________
Directly before the idle message is sent, the following actions are
performed:
1. The printerTranslation property is set to false.
2. The lockScreen property is set to false. If the previous value was
not false, then the screen is redrawn.
3. The lockRecent property is set to false.
4. The lockMessages property is set to false.
5. The numberForm at property is set back to its default: "0.######".
6. The visual effect is disabled.
Note: If you have a runtime error in your idle handler, the only way to
fix it is to select "Script" in the runtime error box.
-----------------------------------
KEYPRESS
The keyPress message is sent directly to the page if a key is pressed
and no button or field has the focus. (This condition exists if the
mouse is clicked outside of all buttons and fields.) The key is passed
along with the message in its numeric format. The keyPress message is
only sent while the Browse tool is active.
If you want a key on you keyboard to perform some action, regardless of
the current button or field, put a keyPress handler in the page.
Be cautious when intercepting the keyPress message. You can easily lock
yourself out of HyperPAD. For example, the following handler in your pad
script makes your keyboard useless within HyperPAD:
handler keypress(k);
begin
end;
Since this handler does not pass the keyPress message on, the keyboard
will appear inactive. If you have a mouse, you will be able to access
and change the script, otherwise you will have to re-boot your machine
(by turning your machine off) and possibly lose some data. To safeguard
against this condition, you can create the following break handler in
every script containing a keyPress handler:
handler break;
begin
edit the script of me;
end;
_______________________________________________________________________
Chapter 1: What's Really Happening 92
________________________________________________________________________
Thus, if you made a mistake in your keyPress handler, you can always
press CTRL+BREAK to edit the script.
The following keyPress handler processes the F11, F12, and CTRL+V
keystrokes, and passes any other keystroke up the object hierarchy:
handler keypress(keyNumber);
begin
get key(keyNumber);
case it of
"f11" : go to page "help";
"f12" : go to page "index";
"ctrl+v" : ;
otherwise : pass;
end;
end;
See Also: key
-----------------------------------
MOUSEDOWN
The mouseDown message is sent to the current page when the
user presses the mouse button and the mouse pointer is not within the
boundaries of any button or field. When the user releases the mouse
button, the mouseUp messsage is sent.
-----------------------------------
MOUSESTILLDOWN
The mouseStillDown message is sent to the current page continuously
while the mouse button is held down. This message will be sent directly
to the current page only if the mouse button was initially pressed
outside of any buttons or fields.
-----------------------------------
MOUSEUP
The mouseUp message is sent to the current page when the mouse button is
released. This message will be sent directly to the current page only if
the mouse button was initially pressed outside of any button or field's
border.
-----------------------------------
NEWBACKGROUND
The newBackground message is sent to the current page when a background
is created. (This message is sent to the new page of the new background,
not the page that was current when the New Background command was
selected.) You can put a handler for the newBackground message either in
the current pad script or the pad script of your Home pad.
_______________________________________________________________________
Chapter 1: What's Really Happening 93
________________________________________________________________________
-----------------------------------
NEWPAD
The newPad message is sent to the new page of a pad after it is created.
The only appropriate place for newPad handlers is in the pad script of
the Home pad because new pads initially have no scripts.
-----------------------------------
NEWPAGE
The newPage message is sent to a page when it is created, just after it
appears on screen. This message is usually passed up the hierarchy,
unless the page has been pasted and has a newPage handler.
The following pad script names each new page according to the creation
time and date.
handler newPage;
begin
set the name of this page to date() && time();
end;
-----------------------------------
OPENPAD
The openPad message is sent to the default page of a newly opened pad,
just after it is displayed. Use this message to perform any
initialization that your pad may require, like the following example:
handler openPad;
begin
global taxTotal,salesTotal;
put 0 into taxTotal;
put 0 into salesTotal;
put empty into page field "first name";
put 0.07 into page field "Sales Tax";
hide page button 5;
end;
See Also: closePad, openPage, closePage
_______________________________________________________________________
Chapter 1: What's Really Happening 94
________________________________________________________________________
-----------------------------------
OPENPAGE
The openPage message is sent to a page just after it becomes the current
page.
The following example uses openPage to set the focus to a default
button:
handler openPage;
begin
set the focus to page button "Pick";
end;
-----------------------------------
QUIT
This message is sent to the current page when the user selects Exit from
the File menu. By intercepting this message, you can prevent the user
from quitting HyperPAD. You can also send a quit message, causing
HyperPAD to return to DOS.
The following handler quits HyperPAD and returns to DOS:
handler select;
begin
answer "Are you sure you want to quit?";
if it is "Ok" then quit;
end;
The next example intercepts the quit message and goes to a pad called
"phone" instead.
handler quit;
begin
go to pad "phone";
end;
-----------------------------------
RESUME
The resume message is sent to the current page when HyperPAD resumes
execution after running another program. After running other programs,
HyperPAD will not complete execution of the script containing the run
command. In the following example, the resume handler performs the
actions that normally would not be executed after a run command:
_______________________________________________________________________
Chapter 1: What's Really Happening 95
________________________________________________________________________
Put this handler in a button:
handler select;
begin
run "C:\COMMAND.COM";
beep; -- this NEVER gets executed
end;
This handler belongs in the page:
handler resume;
begin
beep;
end;
See Also: startUp, openPage, openPad
-----------------------------------
STARTUP
The startUp message is sent to the first page displayed when HyperPAD is
run for the first time that session.
-----------------------------------
SUSPEND
This message is sent to the current page just before the user runs
another program. This occurs when "Run Program" is selected from the
File menu or the run command is executed in a script. By intercepting
this message, you can prevent HyperPAD from launching other programs.
In the following pad script, the suspend handler remembers the disk
space so it can monitor how much space the launched program required:
handler suspend;
begin
put the diskSpace into page field "saved disk space";
pass;
end;
handler resume;
begin
get the diskSpace-page field "saved disk space";
if it 0 then
answer "Your program used" && it && "bytes";
end;
_______________________________________________________________________
Chapter 1: What's Really Happening 96
________________________________________________________________________
COMMON MESSAGE GROUPINGS
Sometimes it is difficult to know what messages are being sent during
common everyday operations. The following section describes some basic
operations and the messages that HyperPAD sends.
These messages are sent when the user starts HyperPAD:
Message: Sent To:
--------------------------------------------------------------
startUp current page
openPad current page
openPage current page
openButton/openField current button or field
These messages are sent when the user runs another program:
Message: Sent To:
--------------------------------------------------------------
closeButton/closeField current button or field
closePage current page
closePad current page
suspend current page
These messages are sent when the user returns from running another
program:
Message: Sent To:
--------------------------------------------------------------
resume current page
openPad current page
openPage current page
openButton/openField default button or field
When the user presses the ESC key, these messages are sent:
Message: Sent To:
--------------------------------------------------------------
keypress 283 current object
cancel current page
_______________________________________________________________________
Chapter 1: What's Really Happening 97
________________________________________________________________________
When the key combination ALT+F5 is pressed, these messages are sent:
Message: Sent To:
--------------------------------------------------------------
keyPress 27648 current object
doMenu "Home" current page
When TAB is pressed to go one button to another button, these messages
are sent:
Message: Sent To:
--------------------------------------------------------------
closeButton current button
openButton new current button
When you press PGDN to go to the next page, these messages are sent:
Message: Sent To:
--------------------------------------------------------------
keyPress 20736 current object
doMenu "Next" current page
closeButton/closeField current object
closePage new current page
openButton/openField new current object
When you click the mouse on a button, these messages are sent:
Message: Sent To:
--------------------------------------------------------------
mouseUp current object
select current object