1456 buttons and 1456 active buttons.

William Overington

Copyright 2000 William Overington

The first point to make about the 1456 buttons and active 1456 buttons introduced in this section is that they have nothing to do with buttons that are defined in any 1456 applet landscape. 1456 buttons are drawn directly from within the 1456 engine under control of 1456 software. 1456 buttons are straightforward to understand. Active 1456 buttons are rather more complicated, yet hopefully still straightforward. 1456 buttons and active 1456 buttons need not be used, but are very useful once understood.

Let us begin with 1456 buttons. 1456 buttons are simply representations of buttons drawn on the screen by means of a command to the eutodraw system. Action codes 9 to 13 are used to draw 1456 buttons on the screen, which means that integers in the range from 900 to 1399 need to be used before a $C command.

The Java language provides a drawing of a 3D button which may be drawn as raised or not raised, filled or unfilled, hopefully giving the look to the eye of a raised or lowered button on the screen. Results are very variable in effect depending upon choice of colour of background and colour of button. Some permutations look really poor and the raised effect is not apparent. Yet others, such as unfilled grey buttons on a grey background look very stylish and effective. Buttons can be drawn, for any given size and colour, in four permuations of raised state and filled state. Action code 9 of the eutodraw system provides a comprehensive drawing for a 3D button. Here is an example for a button drawn in grey, with its top left corner at (200,300) of width 100 pixels and height 50 pixels, raised and unfilled. The 1 in the x position of the third column represents the raised and the 0 in the y position of the third column represents the unfilled. The 908 represents the action code 9 together with colour 8, grey.

x

200

100

1

y

300

50

0

c

908

-2

-2

Action codes 10, 11, 12 and 13 give direct drawings of unraised unfilled, raised unfilled, unraised filled, raised filled 1456 buttons respectively. A grey, raised, unfilled button may be drawn as follows.

x

200

100

y

300

50

c

1108

-2

This completes the initial part of this document on the drawing of 1456 buttons.


A central design feature of the 1456 object code system is that where a facility is added to the system, the attempt is made to add a comprehensive set of features to support that facility, to the extent of adding some features for completeness, even if some of those features will be little used, or possibly never used. This design feature is so that maximum flexibility is provided to the 1456 programmer and so that when the system is in operational use there will be no unnecessary barriers as to what can be achieved.


Let us now look at the matter of 1456 active buttons. When a 1456 button is drawn, one gets the effect as described above, yet the eutodraw system will also check as to whether active 1456 buttons are being used and if so perform various other activities behind the scenes at the same time, without the 1456 programmer needing to concern himself or herself with the matter. The 1456 engine contains a registry for active buttons, which consists of nine arrays, each of 20 items. These arrays consist of four boolean arrays, declared as Java boolean[] arrays, and five integer arrays, declared as Java int[] arrays. The integer arrays store the left, top, width and height values for the button. Thus buttons 0 to 19 are available, none, some or all of which may be active. The main boolean array is called buttonactive. All buttons start off with buttonactive as false. If a button is not active, then it effectively does not exist. Buttons may only become active by specific action by the 1456 programmer. If a button is made active, then buttonleft, buttontop, buttonwidth and buttonheight are all recorded for the button, along with a value for buttonlabel, which will be explained later. The colour of the button is not stored. Once active, values for buttonraisedstate, buttonfilledstate and buttonvisiblestate are automatically updated by the 1456 engine whenever the button is redrawn. This redrawing could be done using any of the action codes 9 to 13 as above or by using any of the action codes 14 to 17 as will be explained below. Action codes 18 and 19 are provided to enable buttons to be blanked out when desired.

A button is made active by entering button defining mode before a button is drawn. The drawing of the button then includes the registering of the button in the active button registry and leaving button defining mode. Thus, in order to define several active buttons, button defining mode needs to be entered once for each active button.

Button defining mode is entered by using a B( command. The contents of the bi1456 register at the time that the B( command is obeyed is stored behind the scenes in the 1456 engine as the "button index to write" value and the contents of the ai1456 register at the time that the B( command is obeyed is stored as the "button label designate" value. A boolean variable named buttonDefiningMode is set as true. The B( command itself does not enter a button in the active button registry, but is a necessary preliminary. When a button is drawn using an action code in the range 9 to 13, if the system is in button defining mode then the button drawn will be added into the registry as the button with index number "button index to write" with the given left, top, width and height values fixed, the "button label designate" value used as the label of the button fixed, and the states of raised and filled that were used to draw the button recorded. The button label may be chosen to be any label within the range 1 to 299. The idea is that when the active button is clicked with the mouse, the 1456 engine will obey 1456 software at the label that is recorded as the button label for that active button. However, there is a little programming needed to achieve that effect, so that it is under precise control of the 1456 programmer.

When a 1456 applet landscape receives a mouse click it may activate the running of some 1456 software and may place, by simulated direct memory access, the position of the mouse at the click in locations within the 1456 engine. For many of my own 1456 applet landscapes, pressing the mouse button causes software at label 41 to be obeyed. The values of the coordinates of the mouse at the time of button press are placed in mi1456[5] and mi1456[6]. Yet this is just an informal small local convention for these early 1456 applet landscapes. This convention is not binding on 1456 applet landscape authors. Indeed, I have used lables 70, 71, 72 and so on when it has suited me to do so. However, when the 1456 engine is trying to locate which active 1456 button is being clicked upon, it uses two values stored behind the scenes to help it in its search. These variables define what is hereinafter called the "action point". These are placed there by the Bx and By commands. Bx and By each use the value in the ai1456 register. So, if the informal small local convention mentioned above is being used in the 1456 applet landscape, the code 41:5&<&wBx6&<&wBy will place the coordinates of the mouse (when the mouse button were pressed) behind the scenes in the correct places. Please note that although the intention at design was that Bx and By would use coordinates from the mouse, this is not obligatory. For example, a game might press a button at random. Yet, let us continue with the presumption that we are seeking to respond to a mouse click on an active button. Having used Bx and By there are now a number of different instructions that are each capable of operating independently and which use the information in the active button registry. Whilst capable of working independently, these commands are often used together. The BJ command will jump to the label of the active 1456 button if the action point is on an active 1456 button. The BC command will call a subroutine at the label of the active 1456 button if the action point is on an active 1456 button. Both BJ and BC will affect the values returned by &U and &V if and only if a jump actually takes place. The Br command sets the linkflag1456 to true if there is an active 1456 button that contains the action point and if there is, that that active button is raised when the Br command is obeyed. Unless both conditions are satisfied linkflag1456 is set to false. The &r command sets the value of ai1456 to 1 if there is an active 1456 button that contains the action point and if there is, that that active button is raised when the &r command is obeyed. Unless both conditions are satisfied ai1456 is set to 0. The &B command sets the value of ai1456 to the index number of the active 1456 button that contains the action point when the &B command is obeyed: if no active 1456 button is found, the value of ai1456 is set to -1.

An example of these instructions being used together is that &rBJ may be used to produce a jump to the label for the currently chosen active 1456 button and have the state of the button in the ai1456 register when it gets there. Please note that this may be the state when the button was clicked, not the state that is supposed to become the new state after the click. It is for the 1456 programmer to display a new drawing of the button, it is not done automatically by the system as a result of the click.

The command B) may be used to remove a given button from being active. The value of bi1456 is used to choose the index number of the button to deactivate. Deactivation of a button is immediate upon the use of the B) command. The B) command is provided for completeness. In many applications involving active buttons it will never be used. Nevertheless B) is provided in case it is needed by a 1456 programmer.

Action codes 14 through to 19 each use a single column of the eutodraw table and only produce any effect when used with an active button. Data for the drawing of buttons or the blanking out of buttons using action codes 14 through to 19 is obtained from the active button registry. This obtaining is in either of two ways, chosen from values sent to the eutodraw table. The first way is by the 1456 engine searching the active button registry for whichever active button contains the chosen action point, where the action point is typically the last place clicked using the mouse. The second way is by the programmer specifying the index number of the active button. The first way is typically used to locate the active button just clicked. The second way is typically used to locate another active button. Sometimes both ways are used, one after the other. For example, clicking one button may cause itself to change state and cause another button to become blanked out. Action code 14 draws the button depressed, 15 draws the button raised, 16 draws the button in its present state and 17 draws the button in the opposite state to which it was in previously, that is, the state is toggled. The reason for action code 16 might not be apparent. However, it is included for two reasons. Firstly, for completeness. Secondly, please remember that colours are not stored in the active button registry, so an action code of 16 could be used to draw a button in the same state but in a different colour, if desired.

x

0

y

0

c

1708

The table above shows the command to toggle an active button, where the action code is 17 and the colour code is 8, namely grey. The x value is 0, which indicates that the active button is specified by being that which contains the action point loaded using the Bx and By commands, so the system searches for an active button that satisfies those criteria and uses the first such that it finds. This use of the first found allows buttons to be set out on top of other buttons if so desired. For example, a large button could have several small buttons upon it. The large button would need to have a larger index number than any of the small buttons. When searching for an active button in this manner the y value in the eutodraw table is set to zero conventionally, but has no effect. In the event that no such button is found, no drawing takes place.

The table below shows the command to toggle an active button specified by the use of the index number of the active button, where the action code is 17 and the colour code is 8, namely grey. The x value is 1, which indicates that the active button to be drawn is the active button that has the index number specified as the y value. In this example, the index number is 5. The index number must be in the range 0 to 19. In the event that the button chosen is not active, no drawing takes place. If the button chosen is active, but not visible, no drawing takes place.

x

1

y

5

c

1708

The table below shows the command to draw an active button in its existing state, where the action code is 16 and the colour code is 8, namely grey. The x value is 2, which indicates that the active button to be drawn is the active button that has the index number specified as the y value and that that button is to become visible, regardless of what is stored in the active button registry. In the event that the button chosen is not active, no drawing takes place. Please note that a button that is hidden remains active. An active button that is made inactive by a B) command cannot be redrawn unless it is first defined as if starting from fresh with the defining of the button. In normal usage, once a button has been defined as active it will not be made inactive at all. The B) command is simply included for completeness.

x

2

y

5

c

1608

In each case, for action codes from 14 to 19, the new state of whether unraised or raised, unfilled or filled, hidden or visible, are all recorded in the button registry, either under the original active button or, if in button defining mode, under the new active button. This possibility of being in button defining mode is added for completeness. There is no obvious application for this at present, yet it is included as action codes 9 to 13 include it, just in case it is ever needed, on the basis that it is easier to include it and it to never be used than to risk that it might someday be needed yet be found to be not available.

demo10.htm

The demonstration shows four active buttons in use. The left button is active button 1 and uses label 61 and draws a filled circle. The left but one button is active button 2 and uses label 62 and draws a filled square. The right but one button is active button 3 and uses label 63 and clears the display and hides the two left buttons. The right button is active button 4 and uses label 64 and restores the two left buttons.

1456 object code

Copyright 2000 William Overington