229
The 2
nd
and 3
rd
lines are there to insert a
function. We need a function when the axes
are plotted or the normal error message will be
displayed (see right), which is undesirable as it
confuses the user. On the other hand we
need
blank
axes, so we use a function
‘Ymax+1’ which is guaranteed to be off-screen
for the entire x axis range no matter what axes are used. Clever, eh?
The next program code we will look at belongs to the 1
st
option on the
VIEWS
menu of ‘Plot axes’.
A message is first given to the user of how to proceed if they want to use
different axes. The flag value of
G
is then set to 1 so that the next program
can tell that the axes are ready to use. The function is also re-entered in case
the user has changed the
SYMB
view. Users have a habit of changing things
so try to allow for this in your programs.
The next program below illustrates a very important technique where a copy
of the
PLOT
view is stored in the aplet’s sketch view and then retrieved and
modified using the various graphics commands. The program is broken into
parts for discussion purposes.
The reason for the “
IF
G==0
THEN
” is to check that the blank axes have
been plotted and are available for use. If not then the user receives a
message to tell them what to do and the remainder of the program is
bypassed. Trying to capture a
PLOT
view that doesn’t exist is a major error.