1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
PROGRAM CheckBoxGad;
uses triton, tritonmacros, utility;
{
A demo in FPC Pascal using triton.library
Updated for fpc 1.0.7
09 Jan 2003
nils.sjoholm@mailbox.swipnet.se
}
VAR
App : pTR_App;
Project : pTR_Project;
close_me : BOOLEAN;
trmsg : pTR_Message;
dummy : Longint;
procedure CleanUp(why : string; err : longint);
begin
if assigned(Project) then TR_CloseProject(Project);
if assigned(App) then TR_DeleteApp(App);
if why <> '' then writeln(why);
halt(err);
end;
begin
App := TR_CreateAppTags([TRCA_Name,'Triton CheckBox',
TRCA_Release,'1.0',
TRCA_Date,'03-06-1998',
TAG_DONE]);
if App = nil then CleanUp('Can''t create application',20);
ProjectStart;
WindowID(1);
WindowTitle('CheckBox');
VertGroupA;
Space;
HorizGroupAC;
Space;
TextID('_CheckBox',10);
Space;
CheckBox(10);
Space;
EndGroup;
Space;
EndGroup;
EndProject;
Project := TR_OpenProject(App,@tritontags);
IF Project = NIL THEN CleanUp('Can''t create Project',20);
close_me := FALSE;
WHILE NOT close_me DO BEGIN
dummy := TR_Wait(App,0);
REPEAT
trmsg := TR_GetMsg(App);
IF trmsg <> NIL THEN BEGIN
IF (trmsg^.trm_Project = Project) THEN BEGIN
CASE trmsg^.trm_Class OF
TRMS_CLOSEWINDOW : begin
if TR_GetCheckBox(Project,10) then
writeln('CheckBox was on')
else writeln('CheckBox was off');
close_me := True;
end;
TRMS_ERROR: WriteLN(TR_GetErrorString(trmsg^.trm_Data));
TRMS_NEWVALUE : begin
IF trmsg^.trm_ID = 10 then begin
if trmsg^.trm_Data = 0 then
writeln('CheckBox off')
else writeln('CheckBox on');
end;
end;
END;
END;
TR_ReplyMsg(trmsg);
END;
UNTIL close_me OR (trmsg = NIL);
END;
CleanUp('',0);
end.
|