The xa,ya parameters hold the values to be loaded into XA and YA, and these store the coordinates of the graphics cursor before the current operation is performed. Similarly, the xb,yb parameters enter values to be stored in XB and YB, and they are used to set the position of the cursor after the new instruction as been executed. So after the new command has done its work, the internal variables can b set up accordingly. For example:
X> 'An instruction that draws a box and then prints some text in it. 'XB YB will be at the end of the box, and not at the printed text! 'The syntax for this is TextBox x1 ,y1,x2,y2,text Userinstruction TextBox,5; [BOx P1,P2,1,P3,P4; PRint P1 ,P2,P5,1; XY P1 ,P2,P3,P4;]
User instructions have a few limitations, which should be remembered. Each command is restricted to a maximum of nine parameters, identified as P1 to P9, and any user-defined instruction can call up to a maximum of ten additional UserInstruction commands from the definition routine.
One additional problem can occur if you want to create a new button type with a UserInstruction. You need to save the parameters somewhere safe before you leave your routine, so that they will be readily available when the new button is selected on the screen. This problem only occurs if you are defining a zone inside a UserInstruction, and the problem can be solved by the following instruction.
SetZonevariable
Interface instruction: save a parameter for the next zone definition
SZ value;
This command is used to set the internal zone variable for the next active zone to be defined. The value can be a number or a string that you want to save, and the Interface stores it in an internal buffer, ready for the new Zone definition. You can now use the ZoneVariable function to poke this value directly into the new zone, so that a "change" routine, held inside the second pair of square brackets, will work as normal. This function is explained lastly..
ZoneVariable
Interface function: read a zone variable from the internal buffer area
value=ZV
This function can only be used inside a change or a draw routine held inside square brackets. It returns the contents of the internal zone variable, and pokes it into your definition for safe- keeping. For example:
X> 'This user instruction defines a button made of text only 'MyButton zone,x,y,text Userinstruction MyButton,4; [SetZone P4; save parameter four in the internal buffer zone BUtton P1,P2,P3,P4 TextWidth 16+,TextHeight 4+,0,0,1; [PRint 0,0,ZoneVariable,1][] zvar permanently installs text into the new button