RosettaCodeData/Task/Simple-windowed-application/Modula-3/simple-windowed-application...

21 lines
608 B
Plaintext

MODULE Click EXPORTS Main;
IMPORT Fmt, TextVBT, ButtonVBT, VBT, Axis, HVSplit, TrestleComm, Trestle;
VAR label := TextVBT.New("There have been no clicks yet.");
button := ButtonVBT.New(TextVBT.New("Click me!"), Clicked);
main := HVSplit.Cons(Axis.T.Ver, label, button, adjustable := FALSE);
count := 0;
PROCEDURE Clicked(<*UNUSED*>button: ButtonVBT.T; <*UNUSED*>READONLY cd: VBT.MouseRec) =
BEGIN
INC(count);
TextVBT.Put(label, "Button pressed: " & Fmt.Int(count));
END Clicked;
<*FATAL TrestleComm.Failure*>
BEGIN
Trestle.Install(main);
Trestle.AwaitDelete(main);
END Click.