ButtonVBT
interface
that provides a VBT type for button objects.
The program exits when the mouse is clicked in the button.
A TextVBT
is a @emph{leaf} VBT, a VBT without VBT subcomponents.
In contrast a ButtonVBT
is VBT with a VBT as a subcomponent.
It provides added features to another VBT
which must be given as an argument when the ButtonVBT
is created.
The appearance of the button on the display is governed by the argument.
In the case of
Push.m3,
we make a button out of a TextVBT
.
This is a common case.
The button looks just like a TextVBT
on the screen.
In this way the button is labeled with some text.
Clicking in a TextVBT
normally has no effect,
but when the TextVBT
is in a ButtonVBT
an action is performed.
The action to perform must be given by providing
a procedure of type ButtonVBT.Proc
which is defined to be
PROCEDURE (self: ButtonVBT.T; READONLY cd: VBT.MouseRec);in the interface module
ButtonVBT.i3
.
The program
Push.m3
defines an action that quits the execution of the program.
This is accomplished by calling the Trestle function Delete
which halts the implicit event-processing loop of the program.
The ButtonVBT
is not the only VBT in the program.
Another TextVBT
is created to display the text ``Hello World.''
The two VBT's are stacked vertically in an inclosing @emph{split} VBT.
The function HVSplit.Cons
takes several
(zero, one, up to nine) VBT's and arranges them horizontally
if the first argument is Axis.T.Hor
, or vertically
if the first argument is Axis.T.Ver
.
A border is put around the button
in order to separate it from the rest of the window,
this can be seen in Push:
The overall size of the window is determined by the ``Hello World''
text VBT which has been given a particular size using the
function RigidVBT.FromHV
.
The first two REAL
parameters to RigidVBT.FromHV
give the minimum size of the VBT in millimeters.